Message156815
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 |
|
Date |
User |
Action |
Args |
2012-03-26 12:04:16 | vstinner | set | recipients:
+ vstinner, gvanrossum, rhettinger, r.david.murray, eric.snow, Jim.Jewett |
2012-03-26 12:04:15 | vstinner | set | messageid: <1332763455.43.0.550397750327.issue14386@psf.upfronthosting.co.za> |
2012-03-26 12:04:14 | vstinner | link | issue14386 messages |
2012-03-26 12:04:14 | vstinner | create | |
|