Message156815
| Author |
vstinner |
| Recipients |
Jim.Jewett, eric.snow, gvanrossum, r.david.murray, rhettinger, vstinner |
| Date |
2012年03月26日.12:04:11 |
| SpamBayes Score |
1.1984557e-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 |
|