-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Unpack namedtuple
#9361
Unpack namedtuple
#9361
Conversation
CI flake: #8795 |
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.
Thanks @hendrikmakait, I think this is a nice feature. Can we add similar functionality to dask.base.unpack_collections
?
942194e
to
46a6b57
Compare
@ian-r-rose, I adjusted |
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.
LGTM, thanks @hendrikmakait!
|
||
Note: This function checks for the existence of the methods and | ||
attributes that make up the namedtuple API, so it will return True | ||
IFF obj's type implements that API. |
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.
Nit: I don't think iff is accurate here, I could easily create an object that has these attributes and is not a namedtuple
.
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.
This might be arguing over semantic details but in that case your object implements the namedtuple
API. I actually tried to word this carefully to NOT say that the object is a namedtuple
. LMK what you think :)
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.
Definitely semantic, I don't expect it to come up. But there's no guarantee that these attributes do the same thing as the namedtuple
APIs.
This PR adds support for unpacking
namedtuple
s inunpack_collections
andto_task_graph
.pre-commit run --all-files