why no 'length' method in sequences ?

Terry Reedy tejarex at yahoo.com
Thu Apr 18 18:37:20 EDT 2002


"Richard Gruet" <rjgruet at yahoo.com> wrote in message
news:a9nbuq$916$1 at aphrodite.grec.isp.9tel.net...
> I just meant that to my human eyes, it is easier to memorize when
everything
> is consistently object oriented and there are only methods

Would you prefer that a+b be written as a.add(b) (which I believe
would be the Python equivalent of what at least one Object-Oriented
language does)?

> (like in Java - and I prefer Python to Java :-), or the contrary,
only functions.

or as add(a,b) (which is the Python version of what some functional
languages do)?

> Then I
> have not to remember which functions are methods and which ones are
> built-in. I think this is because a mixed model is more complicated
than a
> non-mixed one.

An argument can be made for syntactic uniformity, and successful
languages have been designed around that principle.  However, Python
was not.  As I remember, Guido has expressed a belief that a mixture
of function calls, operators, and method calls is *easier* to read.
And the observation that programmers read code as much or more than
they write it is one of the guiding forces of Python design.

Terry J. Reedy






More information about the Python-list mailing list