Thoughts about Python

Matthias no at spam.pls
Tue Feb 24 14:38:51 CET 2004


Duncan Booth <me at privacy.net> writes:

> PPNTWIMBXFFC at spammotel.com (Marco Aschwanden) wrote in 
> news:15c2d03b.0402240311.395f5382 at posting.google.com:
> > *** Problem: Many builtins are not necessary
> > 
> > Many builtins are not necessary. To name a few: min / max / len
> > 
> > This functions should be defined on the class:
> > 
> > ["I", "like", "Python"].len()
> > "I".len()
> > {1:"I", "2":"like", 3:"Python"}.len()
> > (1,2,3,4).len()
> 
> The advantage of min and max as builtins are that they work on any 
> sequence. In particular they work on iterators. Having functions that apply 
> to an arbitrary sequence avoids a lot of potential code duplication.

Do you mean code duplication on the user side?  Or code duplication in
Python's implementations?  In the latter case, it seems strange to
force inconsistent method/function usage on thousands of developers
just in order to save a couple of lines in Python's source code.

To me, Python's builtins are by far not a "problem", but I admit that
I never understood why astring.len() doesn't work.



More information about the Python-list mailing list