[Python-Dev] Generator methods - "what's next" ?
Greg Ewing
greg.ewing at canterbury.ac.nz
Mon Apr 6 00:56:28 CEST 2009
Firephoenix wrote:
> I basically agreed with renaming the next() method to __next__(), so as
> to follow the naming of other similar methods (__iter__() etc.).
> But I noticed then that all the other methods of the generator had
> stayed the same (send, throw, close...)
Keep in mind that next() is part of the iterator protocol
that applies to all iterators, whereas the others are
specific to generators. By your reasoning, any object that
has any __xxx__ methods should have all its other methods
turned into __xxx__ methods as well.
--
Greg
More information about the Python-Dev
mailing list