Skip to content

Commit 81c1833

Browse files
committed
Document CycleError
1 parent c82d41b commit 81c1833

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Doc/library/functools.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,3 +813,19 @@ differences. For instance, the :attr:`~definition.__name__` and :attr:`__doc__`
813813
are not created automatically. Also, :class:`partial` objects defined in
814814
classes behave like static methods and do not transform into bound methods
815815
during instance attribute look-up.
816+
817+
818+
Exceptions
819+
----------
820+
The :mod:`functools` module defines the following exception classes:
821+
822+
.. exception:: CycleError
823+
824+
Subclass of :exc:`ValueError` raised by :meth:`TopologicalSorter.prepare` if cycles exist
825+
in the working graph. If multiple cycles exist, only one undefined choice among them will
826+
be reported and included in the exception.
827+
828+
The detected cycle can be accessed via the second element in the :attr:`~CycleError.args`
829+
attribute of the exception instance and consists in a list of nodes, such that each node is,
830+
in the graph, an immediate predecessor of the next node in the list. In the reported list,
831+
the first and the last node will be the same, to make it clear that it is cyclic.

0 commit comments

Comments
 (0)