... | ... | @@ -316,15 +316,20 @@ Constants are usually defined on a module level and written in all capital lette |
|
|
|
|
|
Correct:
|
|
|
|
|
|
`def f(x): return 2*x`
|
|
|
```python
|
|
|
def f(x): return 2*x
|
|
|
```
|
|
|
|
|
|
Wrong:
|
|
|
|
|
|
`f = lambda x: 2*x`
|
|
|
```python
|
|
|
f = lambda x: 2*x
|
|
|
```
|
|
|
|
|
|
* Use <span dir="">''.startswith()</span> and <span dir="">''.endswith()</span> instead of string slicing to check for prefixes or suffixes.
|
|
|
* Use .startswith() and .endswith() instead of string slicing to check for prefixes or suffixes.
|
|
|
* Don't compare boolean values to True or False using == or is False/ is True
|
|
|
|
|
|
`# Correct:`
|
|
|
|
|
|
`if greeting:` |
|
|
\ No newline at end of file |
|
|
```python
|
|
|
# Correct:
|
|
|
if greeting:
|
|
|
``` |
|
|
\ No newline at end of file |