use str as variable name
Mathieu Prevot
mathieu.prevot at gmail.com
Thu Sep 4 09:01:49 EDT 2008
2008/9/4 Fredrik Lundh <fredrik at pythonware.com>:
> Bruno Desthuilliers wrote:
>
>> You wouldn't write something like 2.__add__(3), would you ?
>
> Don't give the "it's only OO if I write obj.method(args)" crowd more bad
> ideas, please ;-)
>
> (...as Bruno implies, setattr(), len() et al can be and should be viewed as
> generic functions. A specific Python implementation may use custom code to
> implement behaviour for a given object; behaviour that's more efficient than
> a full Python-level method call. For example, in CPython, len(L) is about
> twice as fast as L.__len__() for built-in sequences.)
Got it. Thanks :)
Mathieu
More information about the Python-list
mailing list