A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-April/088257.html below:

[Python-Dev] Generator methods - "what's next" ?

[Python-Dev] Generator methods - "what's next" ?Firephoenix firephoenix at wanadoo.fr
Sun Apr 5 13:31:48 CEST 2009
Hello everyone

I'm a little confused by the recent changes to the generator system...

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...), which gives really weird (imo) 
codes :

   next(it)
   it.send(35)
   it.throw(Exception())
   next(it)
   ....

Browsing the web, I've found people troubled by that asymmetry, but no 
remarks on its causes nor its future...

Since __next__(), send() and others have really really close semantics, 
I consider that state as a python wart, one of the few real ones I can 
think of.

Is there any plan to fix this ? Either by coming back to the next() 
method, or by putting all the "magical methods" of generators in the 
__specialattributes__  bag ?

    next(it)
    send(it, 5)
    throw(it, Exception())
    ...

Thanks a lot for the information,
Pascal



More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4