[Python-ideas] RFC: PEP: Add dict.__version__
Terry Reedy
tjreedy at udel.edu
Mon Jan 11 01:16:19 EST 2016
On 1/9/2016 11:24 PM, Steven D'Aprano wrote:
> On Sat, Jan 09, 2016 at 05:18:40PM -0500, Terry Reedy wrote:
>> Another reason to hide __version__ from the Python level is that its use
>> seems to me rather tricky and bug-prone.
>
> What makes you say that?
We would like to replace slow tortoise steps with quick rabbit jumps.
Is it safe? For avoiding name lookups in dicts, careful dict guards
using __version__ should be enough. For avoiding function calls, they
help but are not enough.
Optimization is empirically tricky and bug prone.
CPython has many private implementation details that have not been
exposed at the Python level because the expected gain is not worth the
expected pain. If __version__ is added, I think exposing it should be
giving separate consideration.
--
Terry Jan Reedy
More information about the Python-ideas
mailing list