Python Forum
instructing f-string over format()
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
instructing f-string over format()
#4
If I look at % then it's still around. I think that .format will also be around for foreseeable future. However there are signs that development of 'convenience' features will be targeted to f-strings.

From Python 3.8 one can do 'print debugging' with f-strings more simpler:

>>> a = 'spam'
>>> b = 'ham'
>>> print(f'{a=} and {b=}')  # instead of f'a={a} and b={b}'
a='spam' and b='ham'
If you look at controversial PEP 572 -- Assignment Expressions ('walrus operator') then one can observe that there are f-strings used as examples and no .format method. It can be interpreted subtle indication of focus of Python development.

In my opinion the promotion of f-strings is targeted to beginners. There is no reason not to learn 'the latest and greatest' features of language. Any professional setting is bound to restrictions imposed by existing codebase.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
instructing f-string over format() - by metulburr - Jul-13-2019, 12:27 AM
RE: instructing f-string over format() - by perfringo - Jul-13-2019, 08:23 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020