[Tutor] object orientation
Alan Gauld
alan.gauld at freenet.co.uk
Mon Nov 15 08:05:42 CET 2004
> to know why we write len(x) instead of x.len()
There was a thread about this a fw weeks ago
- either here or comp.lang.python.
I think history is the real answer. When Guido first built Python
not everything (strings, ints, floats etc) were first class
objects so making len() a function meant it was more generally
useful. Nowadays len() could just as well be an object method.
Alan G.
More information about the Tutor
mailing list