len() and PEP 3000

Klaas mike.klaas at gmail.com
Wed Dec 6 17:32:37 EST 2006


Beliavsky wrote:
> Thomas Guettler wrote:
> > Hi,
> >
> > The function len() is not mentioned in the Python 3000 PEPs.
> >
> > I suggest that at least lists, tupples, sets, dictionaries and strings
> > get a len() method. I think the len function can stay, removing it
> > would break to much code. But adding the method, would bu usefull.
> >
> > Yes, I know, that I can call .__len__() but that is ugly.
>
> I agree with you -- a.__len__() is ugly compared to len(a) . I am
> surprised that such common idioms as len(a) may be going away. It is a
> virtue of Python that it supports OOP without forcing OOP syntax upon
> the user. How can one be confident that Python code one writes now has
> a future?

len() is not going away.

-MIke




More information about the Python-list mailing list