[Python-Dev] iterator API in Py3.0
Jeremy Hylton
jeremy at alum.mit.edu
Fri Mar 3 22:09:34 CET 2006
More information about the Python-Dev mailing list
Fri Mar 3 22:09:34 CET 2006
- Previous message: [Python-Dev] iterator API in Py3.0
- Next message: [Python-Dev] iterator API in Py3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] iterator API in Py3.0
- Next message: [Python-Dev] iterator API in Py3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list