Re:New string formatting in Python
by Rangi42 on Sunday January 03, 2016 @07:35PM
(#10833367)
Also not a fan. The two existing methods of string formatting are sufficient:
If you want placeholders to match variable names, you can do:
So this is just unnecessary (especially since the "f" prefix is easier to miss than a "format" method):
And this is downright obfuscated—putting operators inside of string literals:
[ Parent
| on HN ]
Re:New string formatting in Python
by eugenekolo2 on Sunday January 03, 2016 @08:38PM
(#10833564)
I certainly agree about your last statement, I have no clue what that would do without reading the spec. I'd guess an error, but apparently not.
Re:New string formatting in Python
by roywiggins on Sunday January 03, 2016 @08:11PM
(#10833484)
The PEP says that locals() and globals() solutions were considered, and discarded:
https://www.python.org/dev/peps/pep-0498/#no-use-of-globals-...
You could argue that's not a good enough reason, but it's there.