Ivo, One thing you could have done is explore with simpler code to see if you can deduce what is happening.
If you opened your Python interpreter and tried to see what happens with a simplified variant like this, what do you get? if (match = 5) is not None: pass That might answer your question on why a := might introduce new functionality. Something similar would work fine in a language like C/C++. Heck, it is used often as a concise side effect. Both languages have an == to be used in expressions but with a meaning of COMPARE, not set equal to. I guess someone thought that situations like matching a regular expression would benefit for the side effect. There are workarounds, of course. As an example, in SOME cases, the value of the last expression can be found momentarily in the special variable consisting of a single underscore. But the expression above probably would evaluate to True, ... Ovi -----Original Message----- From: Python-list <python-list-bounces+avigross=verizon....@python.org> On Behalf Of Ivo Shipkaliev Sent: Tuesday, November 27, 2018 5:48 AM To: python-l...@python.org Subject: PEP 572 -- Assignment Expressions Hello. Maybe it's too late for a discussion, but I just couldn't resist. I just found out about this new ":=" operator. I need to ask: What is the need for this additional ":" to the "="? Why: if (match := pattern.search(data)) is not None: # Do something with match What is wrong with: if match = pattern.search(data) is not None: # Do something with match Assignment expression or assignment statement, it's an assignment, right? It is very clear to everyone that it's an assignment! Can't it all just be a "="? Thank you very much! Kind Regards Ivo Shipkaliev -- https://mail.python.org/mailman/listinfo/python-list _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor