[Python-Dev] defaultdict and on_missing()
Nick Coghlan
ncoghlan at gmail.com
Mon Feb 27 13:55:05 CET 2006
More information about the Python-Dev mailing list
Mon Feb 27 13:55:05 CET 2006
- Previous message: [Python-Dev] defaultdict and on_missing()
- Next message: [Python-Dev] defaultdict and on_missing()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg Ewing wrote: > Raymond Hettinger wrote: >> Code that >> uses next() is more understandable, friendly, and readable without the >> walls of underscores. > > There wouldn't be any walls of underscores, because > > y = x.next() > > would become > > y = next(x) > > The only time you would need to write underscores is > when defining a __next__ method. That would be no worse > than defining an __init__ or any other special method, > and has the advantage that it clearly marks the method > as being special. I wouldn't mind seeing one of the early ideas from PEP 340 being resurrected some day, such that the signature for the special method was "__next__(self, input)" and for the builtin "next(iterator, input=None)" That would go hand in hand with the idea of allowing the continue statement to accept an argument though. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
- Previous message: [Python-Dev] defaultdict and on_missing()
- Next message: [Python-Dev] defaultdict and on_missing()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list