why does UserDict.DictMixin use keys instead of __iter__?

Nick Coghlan ncoghlan at iinet.net.au
Wed Jan 5 13:58:02 CET 2005


Steven Bethard wrote:
> Nick Coghlan wrote:
>> .keys() is definitely part of the standard dictionary interface, and 
>> not something the mixin can derive from the generic container methods.
> 
> 
> Why is that?  Isn't keys derivable as:
> 
> def keys(self):
>     return list(self)
> 
> if __iter__ is defined?

As you may have guessed, I completely forgot about __iter__. . .

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list