Allow element-wise comparisons with None#282
Merged
sadielbartholomew merged 2 commits intoNCAS-CMS:masterfrom Nov 25, 2021
Merged
Allow element-wise comparisons with None#282sadielbartholomew merged 2 commits intoNCAS-CMS:masterfrom
None#282sadielbartholomew merged 2 commits intoNCAS-CMS:masterfrom
Conversation
Collaborator
Author
|
Note to selves: think about this as part of the dask work. |
NoneNone
sadielbartholomew
approved these changes
Nov 25, 2021
Member
sadielbartholomew
left a comment
There was a problem hiding this comment.
All good, assuming the desired behaviour for the specific case Bryan raised (as I am guessing from the thread on the corresponding Issue), along with the obvious general behaviour, is that:
In any case, I'm glad you're putting in a PR so the right error is raised rather than a stackdump.
namely that we return the same error as numpy (#281 (comment)), which is indeed implemented:
>>> d = cf.Data(np.array([1, 2, 3]))
>>> if d != None:
... print("nope")
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sadie/cf-python/cf/data/data.py", line 1544, in __bool__
raise ValueError(
ValueError: The truth value of Data with more than one element is ambiguous. Use d.any() or d.all()
Member
|
The linting workflow is failing on some spurious whitespace, which I will deal with after so we can merge this as-is. There is a 3.6 workflow running, too, when it shouldn't as we dropped 3.6, hence the failure of it, so I'll deal with that. |
NoneNone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #281