Mike Meyer wrote:
"Robert Brewer" <[EMAIL PROTECTED]> 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
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to