Skip to content

Commit 3422cb5

Browse files
committed
Small titles
1 parent e435597 commit 3422cb5

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Set
110110
```
111111

112112
### Frozenset
113-
#### Is hashable and can be used as a key in dictionary.
113+
**Is hashable and can be used as a key in dictionary.**
114114
```python
115115
<frozenset> = frozenset(<collection>)
116116
```
@@ -333,7 +333,7 @@ Format
333333
```
334334

335335
### String Options
336-
**"!r" uses object's repr() method, instead of format(), to get a string:**
336+
**"!r" calls object's repr() method, instead of format(), to get a string.**
337337
```python
338338
{'abcde'!r:<10} # "'abcde' "
339339
```
@@ -679,7 +679,7 @@ Cutlery = Enum('Cutlery', 'knife fork spoon')
679679
Cutlery = Enum('Cutlery', {'knife': 1, 'fork': 2, 'spoon': 3})
680680
```
681681

682-
**Functions can not be values, unless they are wrapped.**
682+
#### Functions can not be values, so they must be wrapped:
683683
```python
684684
from functools import partial
685685
LogicOp = Enum('LogicOp', {'and': partial(lambda l, r: l and r),
@@ -925,7 +925,7 @@ b'\x00\x01\x00\x02\x00\x00\x00\x03'
925925
```
926926

927927
### Format
928-
**For standard sizes start format string with:**
928+
#### For standard sizes start format string with:
929929
* `'='` - native byte order
930930
* `'<'` - little-endian
931931
* `'>'` - big-endian
@@ -1088,7 +1088,8 @@ param_names = list(sig.parameters.keys())
10881088
```
10891089

10901090
### Type
1091-
**Type is the root class. If only passed the object it returns it's type. Otherwise it creates a new class (and not the instance!):**
1091+
**Type is the root class. If only passed the object it returns it's type. Otherwise it creates a new class (and not the instance!).**
1092+
10921093
```python
10931094
type(<class_name>, <parents_tuple>, <attributes_dict>)
10941095
```
@@ -1099,7 +1100,8 @@ type(<class_name>, <parents_tuple>, <attributes_dict>)
10991100
```
11001101

11011102
### Meta Class
1102-
#### Class that creates class.
1103+
**Class that creates class.**
1104+
11031105
```python
11041106
def my_meta_class(name, parents, attrs):
11051107
attrs['a'] = 'abcde'
@@ -1116,6 +1118,7 @@ class MyMetaClass(type):
11161118

11171119
### Metaclass Attribute
11181120
**When class is created it checks if it has metaclass defined. If not, it recursively checks if any of his parents has it defined and eventually comes to type.**
1121+
11191122
```python
11201123
class MyClass(metaclass=MyMetaClass):
11211124
def __init__(self):
@@ -1508,7 +1511,8 @@ Line # Hits Time Per Hit % Time Line Contents
15081511
```
15091512

15101513
### Call Graph
1511-
#### Generates a PNG image of call graph with highlighted bottlenecks.
1514+
**Generates a PNG image of call graph with highlighted bottlenecks.**
1515+
15121516
```python
15131517
# $ pip3 install pycallgraph
15141518
from pycallgraph import output, PyCallGraph
@@ -1554,20 +1558,24 @@ index = <array>.argmin([axis])
15541558
left = [[0.1], [0.6], [0.8]] # Shape: (3, 1)
15551559
right = [ 0.1 , 0.6 , 0.8 ] # Shape: (3)
15561560
```
1561+
15571562
**1. If array shapes differ, left-pad the smaller shape with ones.**
15581563
```python
15591564
left = [[0.1], [0.6], [0.8]] # Shape: (3, 1)
15601565
right = [[0.1 , 0.6 , 0.8]] # Shape: (1, 3) <- !
15611566
```
1567+
15621568
**2. If any dimensions differ in size, expand the ones that have size 1 by duplicating their elements.**
15631569
```python
15641570
left = [[0.1, 0.1, 0.1], [0.6, 0.6, 0.6], [0.8, 0.8, 0.8]] # Shape: (3, 3) <- !
15651571
right = [[0.1, 0.6, 0.8], [0.1, 0.6, 0.8], [0.1, 0.6, 0.8]] # Shape: (3, 3) <- !
15661572
```
1573+
15671574
**3. If neither non-matching dimension has size 1, rise an error.**
15681575

15691576
### Example
15701577
**For each point returns index of its nearest point: `[0.1, 0.6, 0.8] => [1, 2, 1]`.**
1578+
15711579
```python
15721580
>>> points = np.array([0.1, 0.6, 0.8])
15731581
[ 0.1, 0.6, 0.8]

0 commit comments

Comments
 (0)