My own list object
Jason Orendorff
jason at jorendorff.com
Tue Feb 5 20:31:00 EST 2002
More information about the Python-list mailing list
Tue Feb 5 20:31:00 EST 2002
- Previous message (by thread): My own list object
- Next message (by thread): Python 2.2 dynamic library problem on Compaq Tru64
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
MDK writes:
> I am trying to create my own special type of list object.
>
> However, when I do x.append('yo') it uses Python's append instead
> of the one from my class.
>
> If this is not easy can someone at least point me to an example of what I
> want to do?
It is very easy. But it requires Python 2.2.
class X(list):
def append(self, something):
print "Hello, world!"
>>> x = X()
>>> x.append(14)
Hello, world!
## Jason Orendorff http://www.jorendorff.com/
- Previous message (by thread): My own list object
- Next message (by thread): Python 2.2 dynamic library problem on Compaq Tru64
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list