diff --git a/README.md b/README.md index 87ebd5c..884f205 100644 --- a/README.md +++ b/README.md @@ -792,12 +792,12 @@ from functools import reduce ### If - Else ```python - if else + = if else ``` ```python ->>> [a if a else 'zero' for a in (0, 1, 0, 3)] -['zero', 1, 'zero', 3] +>>> [a if a else 'zero' for a in (0, 1, 2, 3)] +['zero', 1, 2, 3] ``` ### Namedtuple, Enum, Dataclass diff --git a/index.html b/index.html index 1fff3ec..4143b3c 100644 --- a/index.html +++ b/index.html @@ -795,11 +795,11 @@ func(*args, **kwargs) <bool> = all(el[1] for el in <collection>) # True if empty. -

If - Else

<expression_if_true> if <condition> else <expression_if_false>
+

If - Else

<obj> = <expression_if_true> if <condition> else <expression_if_false>
 
-
>>> [a if a else 'zero' for a in (0, 1, 0, 3)]
-['zero', 1, 'zero', 3]
+
>>> [a if a else 'zero' for a in (0, 1, 2, 3)]
+['zero', 1, 2, 3]
 

Namedtuple, Enum, Dataclass

from collections import namedtuple
 Point     = namedtuple('Point', 'x y')