[Python-Dev] PEP 572: Assignment Expressions

Ivan Levkivskyi levkivskyi at gmail.com
Sun Apr 22 04:16:14 EDT 2018


Replying also to the list.

On 22 April 2018 at 09:14, Ivan Levkivskyi <levkivskyi at gmail.com> wrote:

> On 20 April 2018 at 21:59, Guido van Rossum <guido at python.org> wrote:
>
>> Does the PEP currently propose to *allow* that horrible example? I
>> thought Tim Peters successfully pleaded to *only* allow a single "NAME :=
>> <expr>". You don't have to implement this restriction -- we know it's
>> possible to implement, and if specifying this alone were to pull enough
>> people from -1 to +0 there's a lot of hope!
>>
>>
> * FWIW I an -1 on anything but a simple name.
>
> * Also Tim proposed a good idea to call these "binding expressions".
> Because in contrasts the different purposes. Binding expressions would be
> probably typically used to (temporarily) name an expression, while
> assignment statements are actually creating "variables" -- long living
> names intended to be accessed externally to a class/module. The latter
> access can be programmed to trigger arbitrary complex code (see properties,
> __getattr__/__setattr__, etc).
>
> * Re implementing restrictions: there is a CST -> AST step that will allow
> to easily prohibit unwanted forms (FWIW this is how unpacking an chaining
> is prohibited for annotated assignments).
>
> * Re using plain "=": Although I am still using this in C quite often, I
> was bitten badly by this several times when I was younger, I don't want a
> similar experience when _learning_ Python.
>
> Modulo these points I would be +0 on the PEP.
>
> --
> Ivan
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180422/b0ee8b62/attachment.html>


More information about the Python-Dev mailing list