开发者

Python: Inheriting builtin types dict and list [closed]

开发者 https://www.devze.com 2023-03-07 01:06 出处:网络
开发者_运维问答 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form.
开发者_运维问答 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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.


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


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.


this is for Dict:

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

Edit

update userdict docs link:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消