A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2018-April/152725.html below:

[Python-Dev] PEP 572: Assignment Expressions

[Python-Dev] PEP 572: Assignment Expressions [Python-Dev] PEP 572: Assignment ExpressionsEthan Furman ethan at stoneleaf.us
Tue Apr 17 11:06:26 EDT 2018
On 04/17/2018 07:01 AM, Chris Angelico wrote:
> On Tue, Apr 17, 2018 at 10:17 PM, Nick Coghlan wrote:

>> That ambiguity generally doesn't exist with simple name bindings (I'm
>> excluding execution namespaces with exotic binding behaviour from
>> consideration here, as the consequences of trying to work with those
>> are clearly on the folks defining and using them).
>
> The cool thing about the simple and naive code is that even those
> should work. I don't have an example ready for demo, but I fully
> expect that it would 'just work' the exact same way; the namespace
> would never be retrieved from, only set to.
>
> Hmm. I don't know what the consequences would be on class namespace
> with a non-vanilla dict. Probably functionally identical. But there
> might be some extremely weird cases if the namespace dict accepts
> setitem and then raises KeyError for that key.

If you want to play with a non-standard (okay, wierd) class namespaces, you can try using the assignment expression in 
an Enum class.

--
~Ethan~

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4