Python's raw strings have a hilarious bug
Python string literals are kinda funny
A pop quiz reveals that Python's raw string literals can't end in a backslash, even though the backslash isn't actually escaping the quote. The author finds this funny because implementing f-strings requires a full Python parser, making the raw string limitation seem unnecessary. The post also notes that lambda and assignment expressions must be parenthesized inside f-strings.
the fact that the expression can be terminated by : means that lambda expressions and assignment expressions must be parenthesized inside of f-strings, which is kinda funny i think
- PyWoody
Whenever I read people's takes about Python on HN, I always feel like I'm using an entirely different language.
- dwdz
I'm not a fan of f-strings.
I feel like 90% of new Python features in the last 10 years just increased language complexity without any benefit.
- phyzome
Goofy edge cases aside, I think f-strings are great.
- vova_hn2
I think this is pretty intuitive (I was able to answer the question correctly before opening the spoiler), but I really like raw string designs in Rust and C++11 that allow you to stop worrying about escaping completely.
- ethin
Not really about the content of the blog post but am I the only one bothered by the complete lack of capitalization? Granted it may be because of my screen reader but my TTS engine of choice doesn't pause on un-capitalized words/sentences/phrases/etc. which follow a full stop, so this post unless I read it line by line (minus the code) just blends into complete noise.