You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thought from #28: we could also do something like Exponent = Annotated[int, Gt(0) & MultipleOf(2)].
Implementing & would be easy: it just creates a GroupedMetadata.
Other operators would be trickier: Annotated[str, Foo | Bar] should actually be expressed as Annotated[str, Bar] | Annotated[str, Foo], and I have no idea what XOR would be, I think we’d have to offload that to implementers. So I think this idea has short legs.
The text was updated successfully, but these errors were encountered:
Yeah, & can just be spelled ,; I agree that | should be expressed outside the Annotated[], and I don't think that xor is even expressible in Python types at the moment (without high-grade magic, anyway).
Thought from #28: we could also do something like
Exponent = Annotated[int, Gt(0) & MultipleOf(2)]
.Implementing
&
would be easy: it just creates aGroupedMetadata
.Other operators would be trickier:
Annotated[str, Foo | Bar]
should actually be expressed asAnnotated[str, Bar] | Annotated[str, Foo]
, and I have no idea what XOR would be, I think we’d have to offload that to implementers. So I think this idea has short legs.The text was updated successfully, but these errors were encountered: