Browse Source

Update

pull/1/head
Jure Šorn 7 years ago
parent
commit
62e51d0fa2
1 changed files with 6 additions and 5 deletions
  1. 11
      README.md

11
README.md

@ -64,7 +64,7 @@ Range
```python ```python
range(to_exclusive) range(to_exclusive)
range(from_inclusive, to_exclusive) range(from_inclusive, to_exclusive)
range(from_inclusive, to_exclusive, step_size) # Negative step_size for backward
range(from_inclusive, to_exclusive, step_size) # Negative step_size for backward.
``` ```
Enumerate Enumerate
@ -263,7 +263,8 @@ def multiply_closure(x):
def wrapped(y): def wrapped(y):
return x * y return x * y
return wrapped return wrapped
```
```python
multiply_by_3 = multiply_closure(3) multiply_by_3 = multiply_closure(3)
``` ```
@ -444,7 +445,7 @@ import threading
### Thread ### Thread
```python ```python
thread = threading.Thread(target=<function>, args=(<first arg>, ))
thread = threading.Thread(target=<function>, args=(<first_arg>, ))
thread.start() thread.start()
thread.join() thread.join()
``` ```
@ -588,14 +589,14 @@ type(class_name, parents<tuple>, attributes<dict>)
#### Classes that create classes. #### Classes that create classes.
```python ```python
def my_meta_class(name, parents, attrs): def my_meta_class(name, parents, attrs):
# do stuff
...
return type(name, parents, attrs) return type(name, parents, attrs)
``` ```
##### or ##### or
```python ```python
class MyMetaClass(type): class MyMetaClass(type):
def __new__(klass, name, parents, attrs): def __new__(klass, name, parents, attrs):
# do stuff
...
return type.__new__(klass, name, parents, attrs) return type.__new__(klass, name, parents, attrs)
``` ```

Loading…
Cancel
Save