3 ms·
Tbh the f-string stuff sounds pretty in-pythonic to me… like it would make it much harder to read and abuse.
by liquidpele 3y ago
Tbh the f-string stuff sounds pretty in-pythonic to me… like it would make it much harder to read and abuse.
- notatallshaw 3y agoWhat is or isn't "pythonic" is largely determined by the community not the language. Nothing is stopping the Python community from monkey patching everything like the Ruby community does. The f-string changes arrived because there was a need to formalize the syntax, so other Python parsers, for CPython to move off having a special sub-parser just for f-strings, and to be able decide whether weird edge cases were bugs or features. Once formalized it was decided not to put arbitrary limits on it just because people can write badly formatted code, people are can already do that and it's up to the Python community to choose what is or isn't "Pythonic". FYI, one of the things I'm really looking forward to is being able to write: f"Rows: {'\n'.join(rows)}\n Done!" Which in Python 3.11 is illegal syntax.
- actuallyalys 3y agoPython tends to be permissive and rely on convention over preventing certain practices, sometimes summed up as "we are all consenting adults." E.g., there's multiple inheritance, no private variables, and monkeypatching. I see this change as in the same vein. This change also makes it conceptually simpler [0]. It also appears to reduce technical debt by reducing differences between expressions in f-strings and in the rest of the language. [0]: https://peps.python.org/pep-0701/#how-to-teach-this https://peps.python.org/pep-0701/#how-to-teach-this