-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add Tuple funsor #430
Add Tuple funsor #430
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
|
||
class Product(tuple, metaclass=ProductDomain): | ||
"""like typing.Tuple, but works with issubclass""" | ||
__args__ = NotImplemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the __args__
name have something to do with the typing
module? I would expect Python-builtin-style naming to correspond to some Python concept, and to use ._args
otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's a convention I copied from typing
whose purpose seems to be to signal that __args__
are to be accessed through a typing
introspection API (e.g. typing_extensions.get_args(t)
) rather than directly, perhaps because the internals of typing
change a lot between releases. In a future PR we can add get_origin()
and get_args()
for Domain
s, as suggested in #351.
pair-coded with @fritzo. Addresses #351.