[Python-Dev] assignment expressions: an alternative proposal

Yury Selivanov yselivanov.ml at gmail.com
Tue Apr 24 12:11:50 EDT 2018
On Tue, Apr 24, 2018 at 12:03 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
[..]
> But I do write this:
>
>   def wrapper(func, some_value):
>     value_I_want = process(some_value)
>     def wrapped(*args, **kwds):
>       if value_I_want == 42:
>          ...

But this pattern is more rare than comparing local variables. That's
the point I'm trying to use.  Besides, to make it an assignment
expression under my proposal you would need to use parens. Which makes
it even less likely that you confuse '=' and '=='.

Yury


More information about the Python-Dev mailing list