Update Python coding guidelines authored by Moreau Nicolas's avatar Moreau Nicolas
...@@ -316,15 +316,20 @@ Constants are usually defined on a module level and written in all capital lette ...@@ -316,15 +316,20 @@ Constants are usually defined on a module level and written in all capital lette
Correct: Correct:
`def f(x): return 2*x` ```python
def f(x): return 2*x
```
Wrong: 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 * Don't compare boolean values to True or False using == or is False/ is True
`# Correct:` ```python
# Correct:
`if greeting:` if greeting:
\ No newline at end of file ```
\ No newline at end of file