From 9636f6f75a4a41644b99c0d101033cab697ccc69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Mon, 3 Feb 2020 18:48:14 +0100 Subject: [PATCH] Operator --- README.md | 3 ++- index.html | 3 ++- web/index_for_pdf.html | 4 ++-- web/index_for_pdf_print.html | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 220e32c..0746e5a 100644 --- a/README.md +++ b/README.md @@ -2095,9 +2095,10 @@ from operator import itemgetter, attrgetter, methodcaller ```python import operator as op +elementwise_sum = map(op.add, list_a, list_b) +product_of_elems = functools.reduce(op.mul, ) sorted_by_second = sorted(, key=op.itemgetter(1)) sorted_by_both = sorted(, key=op.itemgetter(1, 0)) -product_of_elems = functools.reduce(op.mul, ) LogicOp = enum.Enum('LogicOp', {'AND': op.and_, 'OR' : op.or_}) last_el = op.methodcaller('pop')() ``` diff --git a/index.html b/index.html index d504607..2047a42 100644 --- a/index.html +++ b/index.html @@ -1840,9 +1840,10 @@ lock.release()
import operator as op
+elementwise_sum  = map(op.add, list_a, list_b)
+product_of_elems = functools.reduce(op.mul, <collection>)
 sorted_by_second = sorted(<collection>, key=op.itemgetter(1))
 sorted_by_both   = sorted(<collection>, key=op.itemgetter(1, 0))
-product_of_elems = functools.reduce(op.mul, <collection>)
 LogicOp          = enum.Enum('LogicOp', {'AND': op.and_, 'OR' : op.or_})
 last_el          = op.methodcaller('pop')(<list>)
 
diff --git a/web/index_for_pdf.html b/web/index_for_pdf.html index dcc0103..8c2bcfb 100644 --- a/web/index_for_pdf.html +++ b/web/index_for_pdf.html @@ -81,7 +81,7 @@ logging, 35

M

main function, 1, 41
-map function, 11
+map function, 11, 31
math module, 7
memoryviews, 29
metaclass attribute, 32
@@ -113,7 +113,7 @@

random module, 8
ranges, 3
recursion, 13
-reduce function, 11
+reduce function, 11, 31
regular expressions, 5-6
requests library, 35, 36

S

diff --git a/web/index_for_pdf_print.html b/web/index_for_pdf_print.html index c430246..2d96707 100644 --- a/web/index_for_pdf_print.html +++ b/web/index_for_pdf_print.html @@ -85,7 +85,7 @@ logging, 35

M

main function, 1, 41
-map function, 11
+map function, 11, 31
math module, 7
memoryviews, 29
metaclass attribute, 32
@@ -117,7 +117,7 @@

random module, 8
ranges, 3
recursion, 13
-reduce function, 11
+reduce function, 11, 31
regular expressions, 5-6
requests library, 35, 36

S