Repository navigation
docs: Specify preferred Python string formatting technique - #13718
Conversation
|
Regarding my suggestion in #13707 (comment): it should be noted that a nit is just a suggested change for a trivial often non-blocking issue. Not all style nits end up in the developer notes (due to various reasons: no clear consensus, not worth documenting, etc.). With that out of the way I'm ACK:ing this PR: The Python documentation is discouraging the use of the old string formatting style (
From older Python 3 documentation about
ACK b1b8863 Trivia: When we move to Python 3.6 we can start using formatted string literals ("f-strings") as well :-) |
|
Thanks. My philosophy is: if it's worth a nit, it's worth documenting (or even better, automating with lint rules) to eliminate review round-trips in the future.
Nice! |
|
@masonicboom I share your love for automation/linting! 🏧😍 |
|
Concept ACK, no strong feelings on what formatting to use, and please do not create PRs that change this all over the place, but for new code it is a good idea to use the new, recommended style consistently.
I really like that! string-formatting as a macro-expression. But it will be a while before 3.6 can be required as minimum without breaking a lot of builds. 3.6.0 was released at the end of 2016. |
|
Agree with @practicalswift and @laanwj
|
b1b8863 docs: Specify preferred Python string formatting technique (Mason Simon) Pull request description: @practicalswift this documents the nit you suggested in my previous PR #13707 (comment) Tree-SHA512: b75335976b30ccbce5c2e3a46e5b6218e797944e7025c17b4e56f294670397d731e1a9f4fe7e809d907136e2e62cd9c2b8404b875b4879a1e3f0b1970b94d5a8
|
ACK |
… technique b1b8863 docs: Specify preferred Python string formatting technique (Mason Simon) Pull request description: @practicalswift this documents the nit you suggested in my previous PR bitcoin#13707 (comment) Tree-SHA512: b75335976b30ccbce5c2e3a46e5b6218e797944e7025c17b4e56f294670397d731e1a9f4fe7e809d907136e2e62cd9c2b8404b875b4879a1e3f0b1970b94d5a8
97c738f [tests] Recommend f-strings for formatting, update feature_block to use them (Anthony Towns) 8ae9d31 Bump minimum python version to 3.6 (Anthony Towns) Pull request description: Python 3.5 has reached [end-of-life](https://devguide.python.org/#status-of-python-branches) as of September 2020, and 3.6 has some moderately nice [features](https://docs.python.org/3/whatsnew/3.6.html): - `f'x = {x}'` as an alternative to `'x = {}'.format(x)` format strings (cf bitcoin/bitcoin#13718 (comment)) - underscore separators for large numbers, like `1_234_567` - improvements to async - improvements to typing module Note that 3.6 is not available in xenial (16.04), but is available in bionic (18.04), while focal (20.04) has 3.8. CentOS 7 and 8 have 3.6.8, Debian stable has 3.7.3, and [gentoo and arch already had 3.6 and 3.7 in 2018](bitcoin/bitcoin#14954 (comment)). ACKs for top commit: MarcoFalke: re-ACK 97c738f Tree-SHA512: ec7fce68845edde4d61a42de12c065fd49e5217311a6fda1323206f091a0afd50f293645dffc27d420127e4e5deb864e953f1b67eff735a0dfbbedd7899a9d60
@practicalswift this documents the nit you suggested in my previous PR
#13707 (comment)