We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Should compile
def func[T <: (+) & (*)](x: T, y: T) -> T = x + x * y
to the equivalent of
def func[T <: ProtocolIntersection[SupportsAdd, SupportsMul]](x: T, y: T) -> T = x + x * y
where SupportsAdd is some special Coconut typing.Protocol for supporting __add__ and ProtocolIntersection is from here.
SupportsAdd
typing.Protocol
__add__
ProtocolIntersection
The text was updated successfully, but these errors were encountered:
Since & is valid Python, we'll probably need to use a custom operator for protocol intersection, which will probably be &:.
&
&:
Sorry, something went wrong.
Blocked on klausweiss/typing-protocol-intersection#4.
I'm just going to implement this with inheritance rather than ProtocolIntersection.
Add protocol intersection operator
be2656e
Refs #709.
Add protocol operators
d5ad1f8
Resolves #709.
No branches or pull requests
Should compile
to the equivalent of
where
SupportsAdd
is some special Coconuttyping.Protocol
for supporting__add__
andProtocolIntersection
is from here.The text was updated successfully, but these errors were encountered: