use str as variable name

Fredrik Lundh fredrik at pythonware.com
Thu Sep 4 04:47:04 EDT 2008


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.)

</F>




More information about the Python-list mailing list