1

I have always been confused and falling over the minute details while inheriting the builtin types in Python e.g. list and dict.

Can you please point to the tutorials and docs which give a comprehensive details about the internals and the syntax involved.

4
  • "minute details"? Like? For Example?
    – S.Lott
    May 18, 2011 at 18:46
  • If your code will depend on the internal details, what happens when the internals change?
    – Messa
    May 18, 2011 at 18:47
  • 1
    you have not read any docs? or? which one? specific questions please...
    – user2665694
    May 18, 2011 at 19:03
  • Suppose I am inheriting dict. I am a bit confused about things like how do you I refer the key-value pairs inside the class. If I use self[key] it clobbers with the internal dict
    – Xolve
    May 19, 2011 at 5:08

3 Answers 3

2

Python Language Reference, §3.4.6, "Emulating container types"

0

Take a look at the custom trackingdict class in my answer to a different Stack Overflow question titled Recursive diff of two python dictionaries (keys and values) which shows it actually being done. It overrides all the methods which can mutate a dictionary object.

0

this is for Dict:

http://docs.python.org/library/userdict.html

Edit

update userdict docs link:

https://docs.python.org/2/library/userdict.html

1
  • this link is dead
    – merv
    Oct 15, 2016 at 19:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.