Why does Python mix OO concepts and non OO concepts for operations on basic types?

Terry Reedy tjreedy at udel.edu
Wed May 22 19:09:23 EDT 2002


"Michael Bauers" <MichaelB at firstlogic.com> wrote in message
news:mailman.1022091281.4506.python-list at python.org...
>
> Why do you say x = []; x.append('a'), but get the length with len(a)
?
>
> Is there a reason for this sort of inconsistency?

In the beginning, there was a decision to make general multitype
functions/methods builtin functions instead of methods.  Hence
type(object) instead of object.type().  For some types (strings and
tuples), this eliminated the need for methods.  Before 2.2,
(1,2,3).len() was not possible.

Terry J. Reedy






More information about the Python-list mailing list