Repository navigation
Process iterable array inputs without testing their truth values - #384
Merged
dgilland merged 3 commits intoOct 29, 2026
Merged
Conversation
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.
Array operations currently truth-test their input before iterating it. For example,
uniq_by(numpy.array([1, 2]))anddifference_by([1, 2], numpy.array([2]))raise the NumPy ambiguous-truth-value error. A populated iterable that returns false is silently treated as empty.Use explicit
Nonechecks in uniqueness, intersection, difference conversion andunzip_with. Empty iterables still yield empty results. Sized empty intersections retain the early return so they do not evaluate an iteratee unnecessarily. Tests model both ambiguous and false truth values without adding a NumPy dependency.Validation: 15 regression cases fail before the fix. Python 3.12: 3001 tests/doctests pass with 100% coverage. Python 3.10: 2642 unit tests pass. Ruff lint/format, mypy over the package and new tests, and
git diff --checkpass. An initial Python 3.10 run hit the existing real-timetest_debounce_max_wait; the complete rerun above passed. Two additional tests preserve the empty-intersection shortcut. Existing comparison semantics are unchanged; this does not address #356.AI assistance: OpenAI Codex (GPT-6), original user request
new 14ta koro aro(make 14 more new contributions). Diff inspection was automated; no human review or personal production usage is claimed.