Author vstinner
Recipients Jim.Jewett, eric.snow, gvanrossum, r.david.murray, rhettinger, vstinner
Date 2012-03-26.12:04:11
SpamBayes Score 1.19846e-06
Marked as misclassified No
Message-id <1332763455.43.0.550397750327.issue14386@psf.upfronthosting.co.za>
In-reply-to
Content
New patch replacing dictproxy() builtin type with collections.mappingview() type:

 - dictproxy() type doesn't need to be a builtin type
 - it is not specific to dict so replace "dict" prefix with "mapping"
 - "view" is a better suffix than "proxy" to indicate that it is a read-only proxy
 - IMO collections is the best place for new containers

I don't understand how collections types are called: should it be MappingView or mappingview?

The code of mappingview is just moved to _collectionsmodule.c to avoid the creation of two short files. PyDictProxy_Type and PyDictProxy_New() are kept and still declared in descrobject.h for backward compatibility.

I fixed the doc to indicate that mappingview methods operate on the *underlying mapping*.

I also added test_views() test.

TODO:

 - mappingview() constructor only accepts dict: it should accept any mapping
 - mappingview.copy() creates a dict, it should create a new object of the same type than the underlying mapping
History
Date User Action Args
2012-03-26 12:04:16vstinnersetrecipients: + vstinner, gvanrossum, rhettinger, r.david.murray, eric.snow, Jim.Jewett
2012-03-26 12:04:15vstinnersetmessageid: <1332763455.43.0.550397750327.issue14386@psf.upfronthosting.co.za>
2012-03-26 12:04:14vstinnerlinkissue14386 messages
2012-03-26 12:04:14vstinnercreate