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



_______________________________________________
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