Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
bpo-35224: Add support for NamedExpr to unparse.py #11670
Oh, my first attempt without parenthesis failed: "(x := 1)" became "x := 1" which raises a SyntaxError. I modified my PR to always add parenthesis.
I will push this change to repair buildbots. If someone finds a smarter solution to omit parenthesis in some cases, please go ahead. I never used unparse.py. I don't think that it should nor that it can produce exactly the same input file, since Python looses many formatting information with code is compiled to bytecode (or even just when compiled to AST).
There are useless parentheses, but as I wrote, it's hard to emit the perfect code only from AST. And I wrote a quick fix to repair the CI ;-)