Hacker News new | past | comments | ask | show | jobs | submit login

Python 3.8 has similar feature for f-strings : https://bugs.python.org/issue36817

print(f"{name=}") expands to print(f"name={name}")




Rust’s `dbg!()` macro also includes the source file name and line number; this C++ `dbg(…)` macro looks to add source file name, line number and function name.


I proposed the idea but the debugging notation seemed to serve a different audience : https://discuss.python.org/t/filename-and-line-number-in-f-s...


Wow I had no idea you could do that with the logging class. I agree it would be smarter to be able to at least have a flag for that to print the rest. Overall I prefer logging to print.

I do think you are right though: if you are trying to debug it is useful to know the line not just a variable name. Now you gotta add garbage to say hey this was from this method and line...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: