-
-
Notifications
You must be signed in to change notification settings - Fork 471
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
[MRG] Iterate through the value attribute #1482
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1482 +/- ##
=======================================
Coverage 97.42% 97.42%
=======================================
Files 66 66
Lines 10182 10182
=======================================
Hits 9920 9920
Misses 262 262
Continue to review full report at Codecov.
|
@@ -329,7 +329,7 @@ class Dataset: | |||
>>> def recurse(ds): | |||
... for elem in ds: | |||
... if elem.VR == 'SQ': | |||
... [recurse(item) for item in elem] | |||
... [recurse(item) for item in elem.value] |
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.
I think this is not needed - shall work without the change, as the iterator will access the value automatically.
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.
Ahh cool, okay didn't know that. Cheers :)
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.
I did suggest we remove that, though. I'm not a fan of DataElement
itself being iterable
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.
I've just now seen that @scaramallion's recommendation has made the v3.0 checklist:
Potentially it's worth making the change to the docs now so that new code that people write based on the docs will be forwards compatible for this recursive iteration pattern?
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.
Yeah, I think so
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.
I agree that this syntax should be encouraged.
Update doc string to use `elem.value`.
Adjusting docs