len() and PEP 3000

Beliavsky beliavsky at aol.com
Wed Dec 6 16:52:54 EST 2006


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?




More information about the Python-list mailing list