for whom it may concern: ```# python3.8: >>&...
# development
w
for whom it may concern:
Copy code
# python3.8:
>>> cast(dict[str, str], dict())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'type' object is not subscriptable
Copy code
# python3.9
>>> cast(dict[str, str], dict())
{}
(all this to say: i broke some code)
h
yeah, have to use
""
for
cast
because it's not a type hint
It's clunky, but I personally prefer
cast("dict[str, str]", foo)
to
Dict[str, str]
w/ an import
b
from __future__ import annotations
?
h
not for
cast
, which is a normal fucntion call rather than an annotation
☝️ 1
b
Ah, of course!
w
so, um: regarding the code i broke (
build-support/bin/generate_docs.py
): should i constrain that to 3.9, or downgrade the syntax? it made it through because
mypy
is happy with either
h
I'm fine with constraining to 3.9 as an M1 user. But not sure if all Pants devs have that. And then it will result in our linters partitioning (maybe that dogfooding is good)
👍 1