Skip to content

Commit

Permalink
Documentation typo.
Browse files Browse the repository at this point in the history
Refs #118.
  • Loading branch information
coady committed Apr 30, 2024
1 parent 4b11af0 commit 6608ac2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions docs/examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"metadata": {},
"source": [
"# Examples\n",
"## mutlimethod\n",
"## multimethod\n",
"Multimethods are a mapping of signatures (tuple of types) to functions. They maintain an efficient dispatch tree, and cache the called signatures."
]
},
Expand Down Expand Up @@ -68,18 +68,18 @@
"\n",
"\n",
"@multimethod\n",
"def chunks(values: Iterable, size):\n",
"def batched(values: Iterable, size):\n",
" it = iter(values)\n",
" return iter(lambda: list(itertools.islice(it, size)), [])\n",
"\n",
"\n",
"@multimethod\n",
"def chunks(values: Sequence, size):\n",
"def batched(values: Sequence, size):\n",
" for index in range(0, len(values), size):\n",
" yield values[index : index + size]\n",
"\n",
"\n",
"list(chunks(iter('abcde'), 3))"
"list(batched(iter('abcde'), 3))"
]
},
{
Expand All @@ -88,7 +88,7 @@
"metadata": {},
"outputs": [],
"source": [
"list(chunks('abcde', 3))"
"list(batched('abcde', 3))"
]
},
{
Expand Down Expand Up @@ -241,7 +241,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.1"
"version": "3.12.3"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion multimethod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class multidispatch(multimethod, dict[tuple[type, ...], Callable[..., RETURN]]):
signature: Optional[inspect.Signature]

def __new__(cls, func: Callable[..., RETURN]) -> "multidispatch[RETURN]":
return functools.update_wrapper(dict.__new__(cls), func)
return functools.update_wrapper(dict.__new__(cls), func) # type: ignore

def __init__(self, func: Callable[..., RETURN]) -> None:
self.pending = set()
Expand Down

0 comments on commit 6608ac2

Please sign in to comment.