Firephoenix schrieb:
> 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.

You're missing an important detail: next()/__next__() is a feature of all
iterators, while send() and throw() are generator-only methods.

The only thing I could imagine is to add a generator.next() method that
is simply an alias for generator.__next__(). However, TSBOOWTDI.

cheers,
Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to