|
|
Log in / Subscribe / Register

A Welcome Syntax

A Welcome Syntax

Posted Apr 24, 2025 18:37 UTC (Thu) by mb (subscriber, #50428)
In reply to: A Welcome Syntax by Wol
Parent article: Template strings accepted for Python 3.14

>The problem is you ass-u-me-ing that the people doing the program know to do it.

No.
The complaint was that the people want to use parenthesis, because that better fits to how they think.
Well, I'm fine with that.
And that Python should allow that.

But that's actually possible with current Python.
Therefore, I really don't know where the problem is.

If you want to use parenthesis, use them.
If you don't want to use parenthesis, don't use them.

And if you don't know the language, learn it.
This is orthogonal to whether async is spelled with or without parenthesis.


to post comments

A Welcome Syntax

Posted Apr 25, 2025 8:53 UTC (Fri) by farnz (subscriber, #17727) [Link]

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.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds