(original) (raw)
28.03.18 22:05, Paul Moore пишеI can't imagine (non-contrived) code where the fact that a is formatted before b is evaluated would matter, so I'm fine with option 3.
If formatting a and evaluating b both raise exceptions, the resulting exception depends on the order.
$ ./python -bb
\>>> a = b'bytes'
\>>> '{}{}'.format(a, b)
Traceback (most recent call last):
File "", line 1, in
NameError: name 'b' is not defined
\>>> f'{a}{b}'
Traceback (most recent call last):
File "", line 1, in
BytesWarning: str() on a bytes instance