Why no list heritable type?
Dave Benjamin
ramen at lackingtalent.com
Wed Dec 22 17:00:42 EST 2004
More information about the Python-list mailing list
Wed Dec 22 17:00:42 EST 2004
- Previous message (by thread): Why no list heritable type?
- Next message (by thread): Why no list heritable type?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Mike Meyer wrote: > "Robert Brewer" <fumanchu at amor.org> writes: > >>>Why aren't built >>>in lists and dictionaries real heritable types that can save >>>this kind of patchwork? >> >>They are since Python 2.2 (IIRC): > > And before Python 2.2 there was the UserList class in the standard > library. Which is still there in 2.4. Shouldn't it be depreciated by > this point? Please keep in mind that the latest stable version of Jython is 2.1, which does not support subclassing "list", and "dict" does not exist at all: Jython 2.1 on java1.4.2_01 (JIT: null) Type "copyright", "credits" or "license" for more information. .>>> class C(list): pass ... Traceback (innermost last): File "<console>", line 1, in ? TypeError: base is not a class object: instance of 'org.python.core.BuiltinFunctions' .>>> class D(dict): pass ... Traceback (innermost last): File "<console>", line 1, in ? NameError: dict I'm sure there are workarounds that will make the above code work in both CPython and Jython, but until there is a stable release of Jython that natively supports subclassing "list" and "dict", I'd appreciate it if we didn't deprecate (or depreciate =) UserList/Dict just yet. I maintain several modules that are portable to both implementations. Dave
- Previous message (by thread): Why no list heritable type?
- Next message (by thread): Why no list heritable type?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list