Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1419,12 +1419,21 @@ are always available. They are listed here in alphabetical order.
:func:`classmethod` for a variant that is useful for creating alternate class
constructors.

Like all decorators, it is also possible to call ``staticmethod`` as
a regular function and do something with its result. This is needed
in some cases where you need a reference to a function from a class
body and you want to avoid the automatic transformation to instance
method. For these cases, use this idiom:

class C:
builtin_open = staticmethod(open)

For more information on static methods, consult the documentation on the
standard type hierarchy in :ref:`types`.

.. index::
single: string; str() (built-in function)

.. index::
single: string; str() (built-in function)

.. _func-str:
.. class:: str(object='')
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -897,17 +897,17 @@ The module defines the following classes, functions and decorators:

See :pep:`484` for details and comparison with other typing semantics.

.. decorator:: no_type_check(arg)
.. decorator:: no_type_check

Decorator to indicate that annotations are not type hints.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing the text after this

The argument must be a class or function; if it is a class, it
This works as class or function :term:`decorator`. With a class, it
applies recursively to all methods defined in that class (but not
to methods defined in its superclasses or subclasses).

This mutates the function(s) in place.

.. decorator:: no_type_check_decorator(decorator)
.. decorator:: no_type_check_decorator

Decorator to give another decorator the :func:`no_type_check` effect.

Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1471,8 +1471,8 @@ class D(C):
def test_meta_no_type_check(self):

@no_type_check_decorator
def magic_decorator(deco):
return deco
def magic_decorator(func):
return func

self.assertEqual(magic_decorator.__name__, 'magic_decorator')

Expand Down