Message408177
Another option for code using Python <3.11, that will work without the `from __future__ import annotations` import, is to do something like this:
```
from graphlib import TopologicalSorter
x: 'TopologicalSorter[str]' = TopologicalSorter({"a": {}, "b": {"a"}})
```
By using a string as the annotation, we give mypy the specificity it needs, but the expression will never need to be resolved at runtime. |
|
Date |
User |
Action |
Args |
2021-12-10 08:54:02 | AlexWaygood | set | recipients:
+ AlexWaygood, asvetlov, JacobHayes |
2021-12-10 08:54:02 | AlexWaygood | set | messageid: <1639126442.18.0.994276022795.issue45359@roundup.psfhosted.org> |
2021-12-10 08:54:02 | AlexWaygood | link | issue45359 messages |
2021-12-10 08:54:02 | AlexWaygood | create | |
|