[Python-ideas] Jump to function as an an alternative to call function

Kirill Balunov kirillbalunov at gmail.com
Sun Aug 19 11:18:56 EDT 2018


вс, 19 авг. 2018 г. в 17:51, Chris Angelico <rosuav at gmail.com>:

> On Mon, Aug 20, 2018 at 12:43 AM, Kirill Balunov
> <kirillbalunov at gmail.com> wrote:
> >
> [...]
> > I have the same feeling and already have asked the same question before
> > https://mail.python.org/pipermail/python-list/2018-February/731241.html.
> The
> > main take away was that it is the CPython implementation detail and that
> > `MappingProxy` type was introduced only in 3.3. I still do not find these
> > arguments convincing. On the other hand with the current status quo -
> > `locals` returns `dict` inside a function, we have only advantages:
> >
> > a) `locals` always returns a dict and is consistent in all places. (To be
> > consistent is always good.)
> >
> > b) This type of question occurs every 6 months (there is always a topic
> to
> > talk about at ML).
> >
> > c) When someone encounters this behavior first time, he thinks that he
> found
> > a bug <- There was no error but nothing happened (gives an opportunity to
> > study the internal details of the CPython implementation, the average
> level
> > increases. Everyone also tries to find a way, something like "I believe,
> > there must be a way, because Python is so dynamic" which theoretically
> > allows you to make even more new discoveries.).
> >
> > d) This is considered by some as a way not to leak the CPython
> > implementation details. (Here I have no comments, let it be on the
> > conscience of others.)
> >
> > e) It leaves a room for a future changes (In fact, in some situations I
> > would like to have this possibility).
>
> Related to (e) is that there is room for other implementations to
> permit changes to locals(), and furthermore, a fully-compliant Python
> implementation may use an actual dictionary for locals, and simply
> return that. (That CPython doesn't is an implementation detail for the
> sake of performance.) Requiring that it be a proxy would impose
> unnecessary cost on the implementation, without benefiting any
> compliant use.
>
> ChrisA
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/


Let me disagree with you. While CPython is only one of the implementations
of the Python language, it is the most common one and defacto is considered
as a standard. Therefore, all the others, to be compliant, try to replicate
all subtleties and features of the basic implementation - CPython. And even
more so, I do not believe that anyone will rely or use such a feature.

I'm not saying that this change should be a part of the Python language
specification. I just said that this is already implied by the
implementation of CPython3 and if you make it more clear with
`MappingProxy` type it will be a net win in my eyes.

With kind regards,
-gdg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180819/2f8976ae/attachment.html>


More information about the Python-ideas mailing list