Python 3.8 and :=

Chris Angelico rosuav at gmail.com
Wed Dec 25 09:22:31 EST 2019


On Thu, Dec 26, 2019 at 1:16 AM Jeff Gitlin <jeff.gitlin at gmail.com> wrote:
>
> With the new operator := in Python 3.8
> that allows you to do things like
>
> if ( x := f() ) == 1:
>
> Is there any reason to use just the assignment operator?

I don't understand the question. Are you asking why the normal "="
operator should be used? For starters, "=" is far more flexible than
":=" in terms of what it can assign to.

ChrisA


More information about the Python-list mailing list