TypeError: 'type' object is not subscriptable
djinnome opened this issue · 1 comments
djinnome commented
If I have the following type signature,
def id_star_line_3(graph: NxMixedGraph, gamma: Collection[Variable]) -> Optional[set[Variable]]:
I get the following error:
test_id_star_alg.py:8: in <module>
from y0.algorithm.identify.id_star import (
../../src/y0/algorithm/identify/__init__.py:6: in <module>
from .id_star import (
../../src/y0/algorithm/identify/id_star.py:136: in <module>
def id_star_line_3(graph: NxMixedGraph, gamma: Collection[Variable]) -> Optional[set[Variable]]:
E TypeError: 'type' object is not subscriptable
But if I change the return type signature from: Optional[set[Variable]]:
to Optional[Collection[Variable]]:
It works. I am running python 3.8.5
cthoyt commented
the trick is the lowercase s in set. Apparently this is py39+ only. Thoughts on enforcing more modern versions of Python for this package?