[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PEP 572 -- Assignment Expressions

   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 "="?
         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