assigning a custom mapping type to __dict__
Nick Coghlan
ncoghlan at iinet.net.au
Wed Mar 2 07:30:09 EST 2005
Steven Bethard wrote:
> support. Inheriting from dict likely means you have to redefine a bunch
> of functions to raise Exceptions saying that they're unsupported.
Hmm. . .
We've got the NotImplemented singleton already to let special methods say "I
thought I might be able to handle this, but I can't".
Maybe "__op__ = NotImplemented" should clear the associated slot. It would also
make it easier to inherit from list and handle slices in __getitem__ by writing
"__getslice__ = NotImplemented" instead of overriding __getslice__ to delegate
to __getitem__.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at email.com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
More information about the Python-list
mailing list