[Python-Dev] defaultdict and on_missing()

Alex Martelli aleaxit at gmail.com
Fri Feb 24 17:47:45 CET 2006


On 2/24/06, Raymond Hettinger <python at rcn.com> wrote:
> > Michael Chermside wrote:
> >> The next() method of iterators was an interesting
> >> object lesson. ... Since it was sometimes invoked by name
> >> and sometimes by special mechanism, the choice was to use the
> >> unadorned name, but later experience showed that it would have been
> >> better the other way.
>
> [Grep]
> > Any thoughts about fixing this in 3.0?
>
> IMO, it isn't broken. It was an intentional divergence from naming conventions.
> The reasons for the divergence haven't changed.  Code that uses next() is more
> understandable, friendly, and readable without the walls of underscores.

Wouldn't, say, next(foo) [[with a hypothetical builtin 'next'
internally calling foo.__next__(), just like builtin 'len' internally
calls foo.__len__()]] be just as friendly etc? No biggie either way,
but that would seem to be more aligned with Python's usual approach.


Alex


More information about the Python-Dev mailing list