Why does Python mix OO concepts and non OO concepts for operation s on basic types?
Syver Enstad
syver-en+usenet at online.no
Wed May 22 16:55:26 EDT 2002
jajvirta at cc.helsinki.fi (Jarno J Virtanen) writes:
> Wed, 22 May 2002 13:13:06 -0500 Michael Bauers wrote:
> >
> > Why do you say x = []; x.append('a'), but get the length with len(a)
> ?
>
> >
> > Is there a reason for this sort of inconsistency?
>
> why not check the FAQ?
>
> http://www.python.org/cgi-bin/faqw.py?req=all#6.5
Yes, but the FAQ seems to be *very* old, it also says that in the
distant future it may be possible to subclass built in types.
I always have to back up in the editor when I am asking an object what
length it has. Like this (I wanna know the length of object foo):
foo. "Aw, It's not a method it's a function that calls a method with
an unsightly name behind the scenes" back the cursor up and write
len(foo) instead of foo.len() which would be much more intuitive.
--
Vennlig hilsen
Syver Enstad
More information about the Python-list
mailing list