News for hackers. Stuff that matters.
Re:Implementing Rust's dbg! in Python by orf on Friday December 11, 2020 @12:35PM (#25388307)
Python now as a semi-shortcut for this (just add = to the end of any f-string expression):

In [8]: print(f'{foo.bar[1]=}') foo.bar[1]='2'

You can do more complex expressions:

In [9]: f'{1+1=}' Out[9]: '1+1=2'

It's not quite as fluid as dbg!(), but it's nice.

Re:Implementing Rust's dbg! in Python by gknoy on Friday December 11, 2020 @04:16PM (#25391099)
For anyone else wondering why we get a syntax error, this seems to be new in 3.8. :)
Re:Implementing Rust's dbg! in Python by giancarlostoro on Friday December 11, 2020 @05:33PM (#25392378)
So anyone using Ubuntu or Debian, maybe for the next major release you can try it out. I love Debian but I hate that I cant just install the latest of Python system wide without potentially breaking system level scripts.
Re:Implementing Rust's dbg! in Python by ageofwant on Friday December 11, 2020 @06:53PM (#25393379)
System Python is for the system, leave it alone. Use https://github.com/pyenv/pyenv and get every Python you want in seconds for your personal use.
Re:Implementing Rust's dbg! in Python by Drdrdrq on Friday December 11, 2020 @05:45PM (#25392539)
Just use pyenv (careful with spelling), then you can use any version you like.
Re:Implementing Rust's dbg! in Python by giancarlostoro on Friday December 11, 2020 @09:17PM (#25394691)
Definitely will have to check it out with two endorsements, I've heard of a few other options, but this might be something I'm actually okay with.
Re:Implementing Rust's dbg! in Python by 0x008 on Saturday December 12, 2020 @10:18AM (#25398713)
What alternatives are there for pyenv besides conda?
Re:Implementing Rust's dbg! in Python by Nullabillity on Saturday December 12, 2020 @03:27PM (#25401387)
Nix?
Re:Implementing Rust's dbg! in Python by raziel2p on Monday December 14, 2020 @03:46AM (#25414816)
If you don't want to use pyenv (I think it's a mess), just look into compiling Python yourself, using a prefix like ~/.local/share/python-$version