Inheritance from builtin list and override of methods.
fredrik at pythonware.com
Mon Nov 27 15:58:25 CET 2006
Michalis Giannakidis wrote:
>> "obj[index] = value" maps to "obj.__setitem__(index, value)". reading
>> the documentation might help; start here:
> In this documentation page it also says:
> then x[i] is equivalent3.2 to x.__getitem__(i).
> This, and other statements, are only roughly true for instances of new-style
> So which statements are actually true for new style classes?
> Is l=1 completely different from l.append(1) or maybe insert?
l.append(1) is a method call. L=1 is syntactic sugar for a
*different* method call. why is this so hard to understand?
More information about the Python-list