From b976dd5c614154fe8b53d538a6964733468211cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Mon, 2 Dec 2019 23:41:57 +0100 Subject: [PATCH] Closure --- README.md | 4 ++-- index.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 884f205..34b1140 100644 --- a/README.md +++ b/README.md @@ -854,8 +854,8 @@ from functools import partial >>> multiply_by_3(10) 30 ``` -* **Partial is also useful in cases when a function needs to be passed as an argument, because it enables us to set its arguments beforehand.** -* **A few examples being `'defaultdict()'`, `'iter(, to_exclusive)'` and dataclass's `'field(default_factory=)'`.** +* **Partial is also useful in cases when function needs to be passed as an argument, because it enables us to set its arguments beforehand.** +* **A few examples being: `'defaultdict()'`, `'iter(, to_exclusive)'` and dataclass's `'field(default_factory=)'`.** ### Nonlocal **If variable is being assigned to anywhere in the scope, it is regarded as a local variable, unless it is declared as a 'global' or a 'nonlocal'.** diff --git a/index.html b/index.html index 4143b3c..db566fd 100644 --- a/index.html +++ b/index.html @@ -843,8 +843,8 @@ creature = Creature(Point(0, 30
    -
  • Partial is also useful in cases when a function needs to be passed as an argument, because it enables us to set its arguments beforehand.
  • -
  • A few examples being 'defaultdict(<function>)', 'iter(<function>, to_exclusive)' and dataclass's 'field(default_factory=<function>)'.
  • +
  • Partial is also useful in cases when function needs to be passed as an argument, because it enables us to set its arguments beforehand.
  • +
  • A few examples being: 'defaultdict(<function>)', 'iter(<function>, to_exclusive)' and dataclass's 'field(default_factory=<function>)'.

Nonlocal

If variable is being assigned to anywhere in the scope, it is regarded as a local variable, unless it is declared as a 'global' or a 'nonlocal'.

def get_counter():
     i = 0