A Python 3000 Question

Rob Wolfe rw at smsnet.pl
Mon Oct 29 17:12:27 EDT 2007


brad <byte8bits at gmail.com> writes:

> 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()?

I wonder why people always complain about `len` function but never
about `iter` or `pprint.pprint`? :)

And to answer the question. In OO programming generic functions
are no less important than classes and objects.

Regards,
Rob



More information about the Python-list mailing list