diff options
Diffstat (limited to 'Doc/library/functools.rst')
-rw-r--r-- | Doc/library/functools.rst | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index 1c8fa5b..4bec7ba 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -44,8 +44,9 @@ The :mod:`functools` module defines the following functions: some portion of a function's arguments and/or keywords resulting in a new object with a simplified signature. For example, :func:`partial` can be used to create a callable that behaves like the :func:`int` function where the *base* argument - defaults to two:: + defaults to two: + >>> from functools import partial >>> basetwo = partial(int, base=2) >>> basetwo.__doc__ = 'Convert base 2 string to an int.' >>> basetwo('10010') @@ -87,8 +88,9 @@ The :mod:`functools` module defines the following functions: This is a convenience function for invoking ``partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated)`` as a function decorator - when defining a wrapper function. For example:: + when defining a wrapper function. For example: + >>> from functools import wraps >>> def my_decorator(f): ... @wraps(f) ... def wrapper(*args, **kwds): |