[Python-Dev] iterator API in Py3.0

Phillip J. Eby pje at telecommunity.com
Sat Mar 4 22:31:26 CET 2006


At 12:05 AM 3/5/2006 +0300, Oleg Broytmann wrote:
>On Sat, Mar 04, 2006 at 03:45:03PM -0500, Phillip J. Eby wrote:
> > At 09:34 AM 3/4/2006 -0800, Anna Ravenscroft wrote:
> > >I think this is a really good point. next() is supposed to get used, by
> > >coders, in regular code - so it shouldn't be __next__. I can understand
> > >the desire for both forms, although that seems it would clutter things up
> > >unnecessarily - particularly if the two do the same thing.
> >
> > By this argument, we should be using ob.len() instead of len(ob), and
> > ob.iter() instead of iter(ob).
>
>    Yes, I think it'd be more consistent and more object-oriented.

I'm not sure that "more object-oriented" should be equated with "good" in 
this context, or indeed any context.  :)  A function is no more or less 
polymorphic than a method in any case, especially if the function is 
normally delegating to a slot or special method in any case.



More information about the Python-Dev mailing list