News for hackers. Stuff that matters.
Re:Things to use in Python 3 by ehsankia on Wednesday May 15, 2019 @03:09AM (#19917053)
They just added a brand new feature in 3.8 that let's you just append = at the end for quick debugging:

>>> f'{5+5=}'

'5+5=10'

>>> foo = 5

>>> f'{foo=}'

'foo=5'

https://docs.python.org/dev/whatsnew/3.8.html#f-strings-now-...

Re:Things to use in Python 3 by gizmo385 on Wednesday May 15, 2019 @03:17AM (#19917090)
This just feels like another example of Python slowly creeping more esoteric syntax into the language, making it harder for beginners to approach the language.
Re:Things to use in Python 3 by jplayer01 on Wednesday May 15, 2019 @03:32AM (#19917144)
Beginners don't have to know or touch any of this though. They can keep using normal strings until at some point they learn about f strings and see a need for them. You don't need to stop adding features to a language just because a beginner won't be able to learn everything. They don't need to.
Re:Things to use in Python 3 by simonh on Wednesday May 15, 2019 @03:53AM (#19917241)
I think the point is, a beginner coming across some code using such esoteric features is going to be a bit lost as to what's going on. With most of Python you can see what it's doing even if you didn't know the syntax before. That's true of basic f-strings, but not so much with some of this stuff.
Re:Things to use in Python 3 by makapuf on Wednesday May 15, 2019 @05:27AM (#19917702)
Yeah languages are meant to be read even by beginners. I think a language like python shines by being small (in design) yet powerful (by capability). Having myriads of "nice for one use case" feature in the language is not the way forward. I long for the time where % format and .format are removed from the language spec. Even if they still work on the implementation for compatibility. Please remove things.
Re:Things to use in Python 3 by batisteo on Wednesday May 15, 2019 @03:14PM (#19922709)
> Please remove things.

We're not done with Python 2 yet. This would be a Python 4 for sure. That's not according the philosophy of backward compatibility of Python (even if I agree with you).

Re:Things to use in Python 3 by makapuf on Wednesday May 15, 2019 @10:13PM (#19925584)
Yes backward compatibility is not an option (lets avoid redoing python3 trauma ) and simply delegating coexistence of old and new features to implementation is a bit lazy. However documenting one way as the current one and other features as old ways, for backward compatibility can simplify things.
Re:Things to use in Python 3 by istjohn on Wednesday May 15, 2019 @07:09AM (#19918224)
As someone who probably relies on print statements too much for debugging, I love this.
Re:Things to use in Python 3 by jacobush on Wednesday May 15, 2019 @05:16AM (#19917645)
I don't get it. Why not just write:

>>> f'{foo}=' 'foo=5'

Re:Things to use in Python 3 by baq on Wednesday May 15, 2019 @07:01AM (#19918175)
there's a pattern in debugging that basically looks like

   print('foo=',foo)
like all languages should, if a pattern is wide-spread, useful and basically boilerplate, python decided to create a language shortcut for it.

   print('f{foo=}')
Re:Things to use in Python 3 by stOneskull on Wednesday May 15, 2019 @03:45PM (#19923016)
f before the quote though
Re:Things to use in Python 3 by baq on Thursday May 16, 2019 @05:25AM (#19927419)
doh! classic 'your bick is dig', can't even edit now :(