Re:Python 3's F-Strings: An Improved String Formatting Syntax
by earthboundkid on Wednesday January 20, 2021 @10:39PM
(#25855088)
Yes. Python in general has gone from being “executable pseudo code” to a series of complex language design trade offs largely because it had failed to grasp the right abstractions in its evolution. Backtick functions in JS are so powerfully clever and basically impossible to recreate in Python.
[ Parent
| on HN ]
Re:Python 3's F-Strings: An Improved String Formatting Syntax
by pansa2 on Wednesday January 20, 2021 @11:28PM
(#25855394)
> Python in general has gone from being “executable pseudo code” to a series of complex language design trade offs
Agree with this 100%.
> because it had failed to grasp the right abstractions in its evolution.
I'd be interested to know what you think the language's designers should have done differently?
Re:Python 3's F-Strings: An Improved String Formatting Syntax
by earthboundkid on Thursday January 21, 2021 @07:09AM
(#25858061)
Let’s go all the way back to `with`. What does it do? It encapsulates try/finally blocks and only try/finally. That is a weirdly specific thing to encapsulate. Why did they do that? Well, it turns out that making an anonymous block syntax that is compatible with Python’s grammar is hard, so you can’t have the equivalent of this JavaScript:
WithOpen(filename, f => {
// block
})
Because blocks aren’t viable, problems have to be solved on a case-by-case basis, which is hard to do well and leaves gaps.