Browse Source

Minor fixes

pull/10/head
Jure Šorn 6 years ago
parent
commit
b1d4e05008
1 changed files with 6 additions and 6 deletions
  1. 12
      README.md

12
README.md

@ -474,7 +474,7 @@ lambda <argument_1>, <argument_2>: <return_value>
<list> = [i+1 for i in range(10)] # [1, 2, ..., 10]
<set> = {i for i in range(10) if i > 5} # {6, 7, ..., 9}
<dict> = {i: i*2 for i in range(10)} # {0: 0, 1: 2, ..., 9: 18}
<iter> = (x+5 for x in range(10)) # (5, 6, ..., 14)
<iter> = (i+5 for i in range(10)) # (5, 6, ..., 14)
```
```python
@ -519,7 +519,7 @@ Point = namedtuple('Point', 'x y')
from enum import Enum
Direction = Enum('Direction', 'n e s w')
Cutlery = Enum('Cutlery', {'knife': 1, 'fork': 2, 'spoon': 3})
Cutlery = Enum('Cutlery', {'knife': 1, 'fork': 2, 'spoon': 3})
# Warning: Objects will share the objects that are initialized in the dictionary!
Creature = type('Creature', (), {'position': Point(0, 0), 'direction': Direction.n})
@ -634,9 +634,9 @@ class <enum_name>(Enum):
<member_name_3> = auto() # Can be used for automatic indexing.
...
@classmethod
def get_names(cls):
return [a.name for a in cls.__members__.values()]
@classmethod
def get_member_names(cls):
return [a.name for a in cls.__members__.values()]
```
```python
@ -1460,7 +1460,7 @@ NumPy
```
```python
value = <array>.min([axis]) # 0: columns, 1: rows
value = <array>.min([axis])
index = <array>.argmin([axis])
```

Loading…
Cancel
Save