A Python 3000 Question

Eduardo O. Padoan eduardo.padoan at gmail.com
Tue Oct 30 07:11:18 EDT 2007


On 10/29/07, brad <byte8bits at gmail.com> wrote:
> Will len(a_string) become a_string.len()? I was just reading
>
> http://docs.python.org/dev/3.0/whatsnew/3.0.html
>
> One of the criticisms of Python compared to other OO languages is that
> it isn't OO enough or as OO as others or that it is inconsistent. And
> little things such as this seem to support those arguments. Not that it
> matters really... just seems that classes with methods used in a more
> consistent manner would be more appropriate in an OO langauage. Is there
> a reason that len cannot be a method?
>
> a_string.lower() makes sense, as does a_string.split(),
> a_string.strip()... why not a_string.len()?

This is a FAQ:
http://effbot.org/pyfaq/why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list.htm


-- 
http://www.advogato.org/person/eopadoan/
Bookmarks: http://del.icio.us/edcrypt



More information about the Python-list mailing list