use str as variable name

Fredrik Lundh fredrik at
Thu Sep 4 10:47:04 CEST 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 ;-)

( 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 


More information about the Python-list mailing list