General q. `bout subclassing

Adrian Eyre a.eyre at optichrome.com
Tue Nov 2 15:21:23 CET 1999


> How do I subclass fundamental stuff like lists etc,

You can't. But you can subclass a UserList (I don't like this either.)

>>> from UserList import UserList
>>> class my_list(UserList):
...     pass
...
>>> l = my_list()
>>> l.append(1)
>>> l.append(2)
>>> l.append(3)
>>> l
[1, 2, 3]
>>> ^D

--------------------------------------------
Adrian Eyre <mailto:a.eyre at optichrome.com>
Optichrome Computer Solutions Ltd
Maybury Road, Woking, Surrey, GU21 5HX, UK
Tel: +44 1483 740 233  Fax: +44 1483 760 644
http://www.optichrome.com 
--------------------------------------------





More information about the Python-list mailing list