How do you control _all_ items added to a list?

Xif xifxif at gmail.com
Mon Feb 28 09:57:09 EST 2005


Quoting Fuzzyman:

"If you subclass list then you will need to override all methods that
can set items."


Overiding all those methods is too much of an effort. I don't really
need them.

I'll just have an object that uses a list internally, and define only
the two methods I really need: extend() and getItems().

That way I retain full control over what goes into the private
obj._list, without the superfluous work of overriding all those methods
I don't really need.

Thanks for your help,
Xif




More information about the Python-list mailing list