Skip to content

Added guidance about using f-strings#55

Open
Onager wants to merge 1 commit into
mainfrom
Onager-fstrings
Open

Added guidance about using f-strings#55
Onager wants to merge 1 commit into
mainfrom
Onager-fstrings

Conversation

@Onager

@Onager Onager commented Oct 25, 2022

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread process/Style-guide.md
* Use the [f-strings](https://peps.python.org/pep-0498/) instead of the `format()` function or %-style of formatting strings wherever possible.
* The codebases are still being migrated to this style, so there may be some stray use of other styles around.
* Use format specifiers with typing, for example, `f'{example:s}'` for increased clarity about the type and formatting of different variables.
* If referencing a string literal in a f-string, use double quotes for the literal. For example: `f'String in dict: {dict["first"]}'`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would recommend using a helper variable here, harder to debug if dict["first"] raises

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants