From a56efa9662b834747bacd137fe645368c6083c2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 18 Mar 2021 15:14:28 +0100 Subject: [PATCH] Map, copy, struct --- README.md | 3 +++ index.html | 3 +++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 6909f1f..caacd07 100644 --- a/README.md +++ b/README.md @@ -773,6 +773,7 @@ for i in range(10): ### Map, Filter, Reduce ```python from functools import reduce + = map(lambda x: x + 1, range(10)) # (1, 2, ..., 10) = filter(lambda x: x > 5, range(10)) # (6, 7, 8, 9) = reduce(lambda out, x: out + x, range(10)) # 45 @@ -1061,6 +1062,7 @@ class MyClassWithSlots: ### Copy ```python from copy import copy, deepcopy + = copy() = deepcopy() ``` @@ -1948,6 +1950,7 @@ Struct ```python from struct import pack, unpack, iter_unpack + = pack('', [, , ...]) = unpack('', ) = iter_unpack('', ) diff --git a/index.html b/index.html index 68b79e8..ba80b5f 100644 --- a/index.html +++ b/index.html @@ -809,6 +809,7 @@ func(*args, **kwargs)

Map, Filter, Reduce

from functools import reduce
+
 <iter> = map(lambda x: x + 1, range(10))            # (1, 2, ..., 10)
 <iter> = filter(lambda x: x > 5, range(10))         # (6, 7, 8, 9)
 <obj>  = reduce(lambda out, x: out + x, range(10))  # 45
@@ -1039,6 +1040,7 @@ Z = dataclasses.make_dataclass('Z', [

Copy

from copy import copy, deepcopy
+
 <object> = copy(<object>)
 <object> = deepcopy(<object>)
 
@@ -1754,6 +1756,7 @@ CompletedProcess(args=['bc', from struct import pack, unpack, iter_unpack + <bytes> = pack('<format>', <num_1> [, <num_2>, ...]) <tuple> = unpack('<format>', <bytes>) <tuples> = iter_unpack('<format>', <bytes>)