Casual programmers, especially those learning Python as a first programming language, aren't well-placed to know which language features they need. If they're learning from multiple sources and tutorial series A teaches Python 2-style %-formatting, B teaches str.format, and C teaches f-strings, then the novice programmer will learn all of these equivalent features.
This also shows up when the novice programmer wants to understand other people's code. If there is only one way to do things, then all common examples of a task should use that one way. If there are multiple ways (as here), then common examples (or an open source project of interest) may use any combination of them. To understand the code, the novice programmer needs to understand all of the right ways to do something rather than one of them.
> If they're learning from multiple sources and tutorial series A teaches Python 2-style %-formatting, B teaches str.format, and C teaches f-strings, then the novice programmer will learn all of these equivalent features.
Isn't the key though, that they aren't in fact equivalent features at all? %-formatting doesn't allow for mapping names or changing the order of variables. f-strings are just a shorter version of .format() and there's no conceptual difference in usage.
> If there is only one way to do things, then all common examples of a task should use that one way. If there are multiple ways (as here), then common examples (or an open source project of interest) may use any combination of them.
Unfortunately, despite all noble efforts of avoiding this, Python is already full of these. This is true for any sufficiently powerful language. That's why there's idiomatic ways (here: "the Pythonic way") of doing things and "freestyling":
x = []
for i in range(4):
if i % 2 == 0:
x.append(i)
y = []
for i in range(0, 4, 2): y.append(i)
z = [i for i in range(4) if i % 2 == 0]
r = [i for i in range(0, 4, 2)]
s = []
i = 0
while i < 4: # or: while (i < 4):
s.append(i)
i += 2 # or: i = i + 2
t = []
i = 0
while True:
t.append(i)
i += 2
if i >= 4: break
# x, y, z, r, s, and t will contain the same values
Every one of the snippets above showcases a different
way of doing the exact same thing in Python. Some are
idiomatic, others ugly, some are outright bad code, yet all are perfectly valid Python.
How would a novice programmer know which of the above is "good" code and what is the preferred way to do it?
A Python tutorial aimed at kids [1] never even mentions "range()", list-comprehensions, "+=", etc. yet enables children to write games in Python.
A Python intro for non-programmers [2] on the other hand shows both for- and while-loops as well as "range()".
So I'd argue that this is a non-starter as even the very basics as taught by recommended sites from the Python website itself [3] differ greatly in scope.
So I [edit]don't[/edit] find f-strings to be a big deal, especially since string formatting is a rather advanced topic anyway and beginners would stick with
for i in [1, 2, 3, 4, 5, 6, 7]:
print("The number", i, "is", "even" if i % 0 == 0 else "odd")
anyway instead of messing with f-string, %, or "format()" - whoops! - accidentally introduced yet another way of doing it :D
Casual programmers can use the same Python that 2.x used - with very little (yet IMO logical) differences.
You can get started just as easily and use/learn (or don't) features as you need/wish.