Why does Python mix OO concepts and non OO concepts for operation s on basic types?
Hans Nowak
wurmy at earthlink.net
Wed May 22 17:56:03 EDT 2002
David LeBlanc wrote:
>
> If item 6.6 in the FAQ is any indication, it's a bit out of date...
That seems indeed to be the case. Or it's Guido's time machine
gone awry... ;-)
> I thought the reason for such built-in functions like len was from an early
> point in Python's development when there where no classes?
Na, AFAIK Python has always had classes, even in ancient 0.9.1, the first
version posted to Usenet. I think the reason is/was, not every built-in
object had methods. (Tuples, strings, numbers, etc.) This has changed
in 2.2, although I don't know all the details; maybe there are
still such objects.
> Isn't there a move afoot to do away with most built-ins? I personally prefer
> str.len() to len(str).
The len() function doesn't bother me really... _some_ builtins will
hopefully always exists, or we'll have to write
(-3).__abs__()
Besides, while Python is object-oriented, that isn't the only
paradigm in the language. People coming from a functional
background may find the len() function more natural than a
method.
YMMV,
--
Hans (base64.decodestring('d3VybXlAZWFydGhsaW5rLm5ldA=='))
# decode for email address ;-)
The Pythonic Quarter:: http://www.awaretek.com/nowak/
More information about the Python-list
mailing list