[Python-Dev] iterator API in Py3.0

Barry Warsaw barry at python.org
Fri Mar 3 22:23:54 CET 2006

On Fri, 2006-03-03 at 13:06 -0800, Michael Chermside wrote:

> I think it's clear that if a method is invoked magically, it ought to have
> underscores; if it is invoked directly then it ought not to. next() is
> invoked both ways, so the question is which of the following invariants
> we would rather maintain:
>   * Any method that gets invoked 'magically' (by syntax) will have
>     underscores.
>   * Any method with underscores should be invoked directly only if
>     you are practicing deep magic.

Practicality beats purity, so IMHO if the user should type it, it should
not have underscores.  If we grow a built-in next() -- which I'm -0 on,
then clearly it should get renamed to __next__() because then the user
would /not/ be expected to write it.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 309 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20060303/cc787145/attachment.pgp 

More information about the Python-Dev mailing list