New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: prefer f-strings to other format/concatentation styles #8474
Conversation
Have you:
- Checked for
%? Just to be sure - Thought of any CI check to prevent this from happening again?
I've been toying around with breaking out this functionality and parts of flake8-pyi to be more generic so that I can more easily detect deprecated typing imports for target python version, f-strings if available, contextlib if available, etc. across open and closed source projects, but I'm concerned that it'll simply lead to more plugin fragmentation than a way to solve the core problem. If you have a suggestion or approach you'd like to see, I'm happy to work on it |
I don't think we really need a CI check for this. It's fine to do cleanups every now and then, but we don't have very many |
* master: Remove `Enum.__hash__`, improve `Enum.__reduce_ex__` (python#8477) refactor: prefer f-strings to other format/concatentation styles (python#8474) Remove redundant `__str__` methods (python#8475) Add some missing stubs in datetimerange (python#8470) tkinter: get rid of unnecessary Incomplete (python#8471) Improve urllib3.util.url annotations (python#8460) Fix `complex` constructor (python#8473) [pre-commit.ci] pre-commit autoupdate (python#8461) Use typeshed.Incomplete and object instead of Any in tkinter stubs (python#8458)
* master: Add `urllib3.contrib.socks`; improve `urllib3.connectionpool` (python#8457) Improve `multiprocessing.context` module (python#8466) Always return `True` from `xml.dom.minidom.Node.__bool__` (python#8480) Adds missing `__dir__` definitions (python#8479) Various pyvmomi improvements (python#8469) Bump pytype version. (python#8478) Remove `Enum.__hash__`, improve `Enum.__reduce_ex__` (python#8477) refactor: prefer f-strings to other format/concatentation styles (python#8474) Remove redundant `__str__` methods (python#8475) Add some missing stubs in datetimerange (python#8470) tkinter: get rid of unnecessary Incomplete (python#8471) Improve urllib3.util.url annotations (python#8460) Fix `complex` constructor (python#8473) [pre-commit.ci] pre-commit autoupdate (python#8461) Use typeshed.Incomplete and object instead of Any in tkinter stubs (python#8458) `io.IOBase`: correct metaclass (python#8468)
Use f-strings for concatenating strings instead of
'+'or.formatPython added f-strings in version 3.6, with PEP 498. F-strings are a flexible and powerful way to concatenate strings. They make the code shorter and more readable, since the code now looks more like the output. In addition, they also come with performance benefits as they reduce the number of times the string must be processed, resulting in faster string processing.
This aligns with the desire to ensure that scripts and tests should support currently supported versions of Python outlined here