From 8d43e7685ac9f8b1a650f129898072e85a5c5f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Fri, 16 Dec 2022 22:00:49 +0100 Subject: [PATCH] Closure --- README.md | 5 +++-- index.html | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d93636f..a2532f6 100644 --- a/README.md +++ b/README.md @@ -852,8 +852,9 @@ from functools import partial ``` ```python ->>> import operator as op ->>> multiply_by_3 = partial(op.mul, 3) +>>> def multiply(a, b): +... return a * b +>>> multiply_by_3 = partial(multiply, 3) >>> multiply_by_3(10) 30 ``` diff --git a/index.html b/index.html index 4a28299..5703327 100644 --- a/index.html +++ b/index.html @@ -723,8 +723,9 @@ player = Player(point, direction) # <function> = partial(<function> [, <arg_1>, <arg_2>, ...]) -
>>> import operator as op
->>> multiply_by_3 = partial(op.mul, 3)
+
>>> def multiply(a, b):
+...     return a * b
+>>> multiply_by_3 = partial(multiply, 3)
 >>> multiply_by_3(10)
 30