We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 36ae4c0 commit f7823acCopy full SHA for f7823ac
1 file changed
CONTRIBUTING.md
@@ -18,6 +18,27 @@
18
19
* Avoid using reserved keywords like `id` in variable names.
20
21
+* Prefer inline format strings for readability whenever possible.
22
+
23
+### Prefer NOT to do this:
24
25
+```python
26
+theword = 'out'
27
+fstring_a = 'Who let %d dogs %s?' % (100, theword)
28
+fstring_b = 'Who let {:d} dogs {:s}?' % (100, theword)
29
+```
30
31
+### Prefer the inline style:
32
33
34
35
+fstring_a = f'Who let {100:d} dogs {theword:s}?'
36
+# Sometimes, this style is necessary:
37
+base_string = f'Who let {:d} dogs {:s}?'
38
+...
39
+parsed_string = base_string.format(100, theword)
40
41
42
* Don't use `map` or `filter`, use list comprehension for readability and clarity:
43
44
### DO NOT DO THIS:
0 commit comments