TypeForm/type compatibility #9397
Replies: 1 comment 9 replies
-
I feel like we're at somewhat of an impasse on the other thread. There are at least three different viewpoints voiced in that thread.
Carl has been an advocate of option 3. I'm pretty opposed to this, as it's unsound in some cases (like the examples I gave above), would be nearly impossible to spec because of the diversity of undocumented types used to encode type forms at runtime, and would be an ongoing maintenance burden as this list expands from one Python release to the next. I don't know how strongly Carl feels about his position. I could maybe be convinced to support option 2, but I would first like to hear a principled justification for special-casing only If you want to advance the discussion, perhaps you can come up with some principle or rule that justifies why we would special-case Back to your particular code sample above... If your code needs to support both In any case, I wouldn't recommend using |
Beta Was this translation helpful? Give feedback.
-
I was unsure on discussion vs issue, but leaned discussion as this still open here with last comment on it about month back.
My codebase often calls functions that are intended for TypeForm most commonly with Unions for non-basic types. I tried testing pyright with enableExperimentalFeatures on. One common code pattern that triggered errors,
or maybe,
Realistic cases having more stuff happening in f besides just g, but that's core of it.
Are you open to relaxing this/making them compatible? Or waiting for more discussion in forum/mypy implementation to compare behavior on.
One thing I also noticed is some of strictness on type vs typeform is different with 3.9 vs 3.10. This is likely typeshed related, but recently upgrading to 3.10 it's increased my want to enable TypeForm. I'm just unsure if I want to add several dozen type ignores for code similar to the example.
Beta Was this translation helpful? Give feedback.
All reactions