A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-January/070530.html below:

[Python-Dev] DRAFT: pydev summary for 2006-12-01 to 2006-12-15

[Python-Dev] DRAFT: pydev summary for 2006-12-01 to 2006-12-15 [Python-Dev] DRAFT: pydev summary for 2006-12-01 to 2006-12-15Walter Dörwald walter at livinglogic.de
Tue Jan 9 14:02:10 CET 2007
Calvin Spealman wrote:

> [...]
> -----------------------------------
> Creating dicts from dict subclasses
> -----------------------------------
> 
> A common problem of subclassing built-in types (dict, in this case) arose trying
> to move weakref.WeakValueDictionary to a subclass of dict, rather than UserDict.
> 
> [NOTE: Could someone give a better description of this? I don't know enough of
> the issue here to write any content full enough. Thanks.]

The problem is that if you pass a mapping (i.e. something with a keys() 
method) to the dict constructor, it uses keys() and __getitem__() to 
make a copy. However if the argument is a subclass of dict, any 
overwritten keys() or __getitem__() methods are ignored.

Servus,
    Walter


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4