-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable --no-wrap in the Jupyter kernel #687
Comments
Forgot to mention, that fwd ref is coming from the string. I can remove that issue with more evals, or (I guess?) some kind of recursive eval when there are type aliases.
This works fine (except for the complaint about |
This is what |
Another question here maybe worth considering is whether |
str
, rather than typing.TypeAliasType
From the new documentation for type aliases, e.g.
>>> 'int'
Is this expected behavior? I realize mypy probably doesn't care if typehints are str or not, but runtime typechecking (say,
isinstance
, or --- what i'm testing here ---beartype
) needs class instances to operate.Using
eval
can be a nasty work around for this, but I ran into a problem if the type aliases are used in future definitions.This nested generic type unfortunately can't be used with
isinstance
, but it's a normal check e.g. for beartype (which I thought the door API would pair lovely with coconut! 😄):as they point out, this use of
ForwardRef
probably won't be around forever, if I'm understanding?It works fine without the new syntax:
As an aside here, I do think friendly interop with
beartype
has a lot of potential for functional style e.g. coconut, since it clarifies a ton of nasty situations liketype(MyEnum.member) is MyEnum
, and runs very fast. Providing an option for beartype users to run coconut with e.g. abeartype.typing
backend would be very nice. See some other examples if this is interesting to you, e.g. the explanation fornumerary
or ... this other proposal I'm on, dealing with faster type-based dispatch viaplum
. I'm hoping to use beartype+plum for some kind oftypeclass
approximation soon, for rich type-based ad hoc polymorphism 😅 (rather than just pattern matching... more like rust traits)The text was updated successfully, but these errors were encountered: