A Welcome Syntax
A Welcome Syntax
Posted Apr 25, 2025 8:53 UTC (Fri) by farnz (subscriber, #17727)In reply to: A Welcome Syntax by mb
Parent article: Template strings accepted for Python 3.14
No.
The complaint is that Python permits you to use a space instead, which results in people getting confused by the code they copy-and-paste from elsewhere, since they don't understand why they're "returning" something here, and come up with all sorts of weird mental models for how await changes the context after it - e.g. that await foo() + bar() is semantically the same as await foo() + await bar().
Python should not use the same syntactic convention for "things that return a value from this function to its caller (such as yield and return)" and "things that evaluate something into a different type of value (such as await)".
Adopting a Rust-like "postfix await" would also work for this - because it means that it's a different syntax for a different behaviour - but I would expect that to be a much bigger sell to Python people than parens.
