3 ms·
Not mentioned in the article, but with Python 3.8, f-strings have gained the ability to print debug information using `=` specifier. name = 'world' pri
by abdusco 6y ago
Not mentioned in the article, but with Python 3.8, f-strings have gained the ability to print debug information using `=` specifier.
name = 'world'
print(f'hello {name.upper()=}')
outputs:
hello name.upper()='WORLD'
It's small, but very useful in debugging an issue or logging something to the console.
https://docs.python.org/3/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging https://docs.python.org/3/whatsnew/3.8.html#f-strings-suppor...
- cabalamat 6y agoThat's something I didn't know, but will know be using.
- richardARPANET 6y agoWay better -> https://pypi.org/project/q/ https://pypi.org/project/q/
- Denvercoder9 6y agoThe fact that it can only output to a single hardcoded file already proves that it is not way better in the general case.
- deleted 6y ago[deleted]
- ipiz0618 6y agoThis is neat! I can think of several instances where this would be useful in my code