[Python-ideas] Idea : for smarter assignment?

Pavol Lisy pavol.lisy at gmail.com
Tue Jul 25 14:23:13 EDT 2017


On 7/25/17, MRAB <python at mrabarnett.plus.com> wrote:
> On 2017-07-25 18:02, Nick Timkovich wrote:
>> On Fri, Jul 21, 2017 at 12:59 PM, David Mertz <mertz at gnosis.cx
>> <mailto:mertz at gnosis.cx>> wrote:
>>
>>     But you've left out quite a few binding operations.  I might forget
>>     some, but here are several:
>>
>>
>> Ned Batchelder had a good presentation at PyCon 2015 about
>> names/values/assignments/binding: https://youtu.be/_AEJHKGk9ns?t=12m52s
>> His summary of all assignment operators:
>>
>> X = ...
>> for X in ...
>> class X: pass
>> def X: pass
>> def fn(X): # when called, X is bound
>> import X
>> from ... import X
>> except ... as X:
>> with ... as X:
>>
> There's also:
>
> import ... as X
> from ... import ... as X

globals()['X'] = ...


More information about the Python-ideas mailing list