Skip to content

Commit 329eb7a

Browse files
committed
PEP 8108: Consistent use of backticks for coroutinedispatch in documentation
1 parent eed47e1 commit 329eb7a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

peps/pep-8108.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ Created: 16-Nov-2025
88
Abstract
99
========
1010

11-
This PEP proposes the addition of a `coroutinedispatch` class to the `functools` module in Python's standard library. The `coroutinedispatch` class enables method overloading based on argument types, supporting both synchronous and asynchronous methods. This feature simplifies the implementation of polymorphic behavior in Python, making it easier to write clean and maintainable code.
11+
This PEP proposes the addition of a ``coroutinedispatch`` class to the ``functools`` module in Python's standard library. The ``coroutinedispatch`` class enables method overloading based on argument types, supporting both synchronous and asynchronous methods. This feature simplifies the implementation of polymorphic behavior in Python, making it easier to write clean and maintainable code.
1212

1313
Motivation
1414
==========
1515

16-
Python currently lacks built-in support for method overloading based on argument types. While developers can achieve similar functionality using conditional statements or external libraries, these approaches often result in verbose and less readable code. Adding a `coroutinedispatch` class to the standard library would:
16+
Python currently lacks built-in support for method overloading based on argument types. While developers can achieve similar functionality using conditional statements or external libraries, these approaches often result in verbose and less readable code. Adding a ``coroutinedispatch`` class to the standard library would:
1717

1818
- Provide a standardized and Pythonic way to implement method overloading.
1919
- Enhance code readability and maintainability.
@@ -22,16 +22,16 @@ Python currently lacks built-in support for method overloading based on argument
2222
Rationale
2323
=========
2424

25-
The `coroutinedispatch` class leverages Python's type hints and introspection capabilities to match method implementations based on argument types. This design aligns with Python's dynamic nature while encouraging the use of type annotations. By integrating this functionality into the `functools` module, we ensure consistency with other utility features for functional programming.
25+
The ``coroutinedispatch`` class leverages Python's type hints and introspection capabilities to match method implementations based on argument types. This design aligns with Python's dynamic nature while encouraging the use of type annotations. By integrating this functionality into the ``functools`` module, we ensure consistency with other utility features for functional programming.
2626

2727
Specification
2828
=============
2929

30-
The `coroutinedispatch` class will be implemented as follows:
30+
The ``coroutinedispatch`` class will be implemented as follows:
3131

32-
- **Registration of Methods**: Developers can register multiple implementations of a method using the `@coroutinedispatch` decorator. The decorator inspects the argument types of the decorated function and stores the implementation accordingly.
33-
- **Type Matching**: When the method is called, the `coroutinedispatch` class matches the provided arguments against the registered implementations. If no exact match is found, a `TypeError` is raised.
34-
- **Support for Async Methods**: The `coroutinedispatch` class distinguishes between synchronous and asynchronous contexts, allowing developers to define separate implementations for each.
32+
- **Registration of Methods**: Developers can register multiple implementations of a method using the ``@coroutinedispatch`` decorator. The decorator inspects the argument types of the decorated function and stores the implementation accordingly.
33+
- **Type Matching**: When the method is called, the ``coroutinedispatch`` class matches the provided arguments against the registered implementations. If no exact match is found, a ``TypeError`` is raised.
34+
- **Support for Async Methods**: The ``coroutinedispatch`` class distinguishes between synchronous and asynchronous contexts, allowing developers to define separate implementations for each.
3535

3636
Example Usage
3737
-------------
@@ -73,22 +73,22 @@ Example Usage
7373
Backwards Compatibility
7474
=======================
7575

76-
This proposal introduces a new class to the `functools` module and does not modify any existing functionality. As such, it is fully backwards compatible.
76+
This proposal introduces a new class to the ``functools`` module and does not modify any existing functionality. As such, it is fully backwards compatible.
7777

7878
Security Implications
7979
=====================
8080

81-
The `coroutinedispatch` class relies on Python's type hints and introspection capabilities. It does not introduce any new security risks beyond those inherent to dynamic type checking.
81+
The ``coroutinedispatch`` class relies on Python's type hints and introspection capabilities. It does not introduce any new security risks beyond those inherent to dynamic type checking.
8282

8383
How to Teach This
8484
=================
8585

86-
The `coroutinedispatch` class should be documented in the Python standard library reference, with examples demonstrating its usage. Tutorials and guides on functional programming in Python can include sections on `coroutinedispatch` to showcase its benefits.
86+
The ``coroutinedispatch`` class should be documented in the Python standard library reference, with examples demonstrating its usage. Tutorials and guides on functional programming in Python can include sections on ``coroutinedispatch`` to showcase its benefits.
8787

8888
Reference Implementation
8989
=========================
9090

91-
A reference implementation of the `coroutinedispatch` class is provided below:
91+
A reference implementation of the ``coroutinedispatch`` class is provided below:
9292

9393
.. code-block:: python
9494

0 commit comments

Comments
 (0)