Most PEPs (Python Enhancement Proposal) tend do go under the radar of most developers, but PEP 572 has caused a lot of controversy in the Python community, with some developers expressing an intense dislike for the new syntax (and that is sugar coated).
Personally, I don't think it deserves the vitriol it received, and I'm looking forward to its addition in Python 3.8.
So what are assignment expressions? Currently in Python assignments have to be statements, so you can do foo = bar()
, but you can't do that assignment from within an if
or while
statement (for example). Which is why the following is a syntax error: continue reading…