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
allow writing Literal[<args>] as {<args>}, i.e. a set literal, and only a set literal
the same rules apply to <args> as for typing.Literal
this example illustrates that | works in the same way for sets as it does for Literal, making this a rather intuitive syntax, that additionally highlights the unique and unordered nature of Literal types, and automatically disallows unhashable (i.e. immutable) types
note that the order isn't lost, as this is but a syntactical conversion
also note that Falsy is a nested Literal, which, unlike union-ed Literals, is automatically unpacked and de-duplicated at runtime, so should for the sake of consistency also be the preferred approach within stubs
The text was updated successfully, but these errors were encountered:
allow writing
Literal[<args>]
as{<args>}
, i.e. a set literal, and only a set literalthe same rules apply to
<args>
as fortyping.Literal
this example illustrates that
|
works in the same way forset
s as it does forLiteral
, making this a rather intuitive syntax, that additionally highlights the unique and unordered nature ofLiteral
types, and automatically disallows unhashable (i.e. immutable) typeswith the default
--target=3.10
, this translates tonote that the order isn't lost, as this is but a syntactical conversion
also note that
Falsy
is a nestedLiteral
, which, unlike union-edLiteral
s, is automatically unpacked and de-duplicated at runtime, so should for the sake of consistency also be the preferred approach within stubsThe text was updated successfully, but these errors were encountered: