Skip to content

Rewrite of '%s' % tuple changes behaviour #8

@asottile

Description

@asottile

(note this is a minimal case, the rule that pyupgrade uses is to avoid 1-ary formats with a single variable on the right hand side since it is not possible to know statically whether that is a format-of-tuple or a format-of-scalar)

before

x = (1,)
print('%s' % x)
$ python3 t.py
1

after

x = (1,)
print(f"{x}")
$ python3 t.py
(1,)

from the testsuite of pyupgrade

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions