Inheritance from builtin list and override of methods.

Fredrik Lundh fredrik at pythonware.com
Mon Nov 27 04:50:33 EST 2006


Michalis Giannakidis wrote:

>> in general, methods on C objects are implemented in terms of operations
>> on the internal data structures, not in terms of a subset of the methods
>> already provided by the object.
> 
> But what is the reason that the assignment 
> l[2] = 6 
> call my function, but
> l.append(3) 

"obj[index] = value" maps to "obj.__setitem__(index, value)".  reading 
the documentation might help; start here:

     http://docs.python.org/ref/specialnames.html

</F>




More information about the Python-list mailing list