Python 3.8 and :=

2019-12-25 Thread Jeff Gitlin
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?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.8 and :=

2019-12-25 Thread Jeff Gitlin
On Wednesday, December 25, 2019 at 9:22:56 AM UTC-5, Chris Angelico wrote:
> On Thu, Dec 26, 2019 at 1:16 AM Jeff Gitlin  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

Chris,
Can you give me a few examples of what you can do with  = and not do with the 
new :=    ?
Thanks
    Jeff
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.8 and :=

2019-12-25 Thread Jeff Gitlin
On Wednesday, December 25, 2019 at 9:13:09 AM UTC-5, Jeff Gitlin 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?

………..
Thanks. That web page is exactly what I was looking for!
-- 
https://mail.python.org/mailman/listinfo/python-list