[Python-ideas] RFC: PEP: Add dict.__version__

Terry Reedy tjreedy at udel.edu
Mon Jan 11 01:36:19 EST 2016


On 1/10/2016 3:02 PM, Victor Stinner wrote:

> In the PEP, I wrote "The PEP is designed to implement guards on
> namespaces, only the dict type can be used for namespaces in practice.
> collections.UserDict is modified because it must mimicks dict.

collections.UserDict mimics the public interface of dict, not internal 
implementation details.  It uses an actual dict to do this.  If 
__version__ is not exposed at the python level, it will not be and 
should not be visible via UserDict.

> collections.Mapping is unchanged."
> https://www.python.org/dev/peps/pep-0509/#changes
>
> Is it enough? If no, what do you suggest to be more explicit?

Your minimal core proposal is or should be to add a possibly private 
.__version__ attribute to CPython dicts, so as to enable astoptimizer. 
Stick with that.  Stop inviting peripheral discussion and distractions. 
  Modifying UserDict and exposing __version__ to Python code are 
separate issues, and can be done later if later deemed to be desirable.

-- 
Terry Jan Reedy



More information about the Python-ideas mailing list