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/2006-March/062038.html below:

[Python-Dev] iterator API in Py3.0

[Python-Dev] iterator API in Py3.0Jeremy Hylton jeremy at alum.mit.edu
Fri Mar 3 22:09:34 CET 2006
On 3/3/06, Raymond Hettinger <raymond.hettinger at verizon.net> wrote:
> The double underscore convention is appropriate where the method is always
> invoked magically in normal code and not called directly.  The next() method is
> differenct because it is a mixed case, sometimes called magically and sometimes
> called directly.  In the latter case, the name is highly visible and therefore
> should not have double underscores.
>
> I suspect that those who feel differently are ones who usually avoid calling
> next() directly.  That's okay, but we shouldn't muck-up the naming for the rest
> of us who often do have a need to use next().
>
> This is doubly important because we're now expanding the protocol to include
> send() and throw().  Adding underscores around them too will only make those
> methods look harder to use than they actually are.  Don't underestimate the
> psychological revulsion to calling code filled with piles of double underscores.

I think it is a little odd that next is not spelled __next__, but I
appreciate the reasons given here in particular.  Every time I right
.next(), I'm happy that it doesn't have underscores.

Jeremy
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