Raymond Hettinger <[email protected]> added the comment:
Simon, I think the conversation is starting to drift and would best be
continued on python-ideas or StackOverflow. Ideas like peekable generators
have been discussed before but there was almost no uptake.
Several thoughts:
* For equal inputs, ndiff() is supposed to generate non-empty output. It does
not just give differences.
* To the extent that you care about empty results from some other iterator, the
easiest thing to do is follow Tim's advice and just list() the iterator.
* The special case of equal inputs is easily handled before running the diff:
if a == b:
do_something_for_the_equal_case(a, b)
else:
d = ndiff(a, b)
do_something_for_the_non_equal_case(a, b, d)
I recommend closing this issue because it hasn't elicted anything that is both
actionable and desireable.
----------
nosy: +rhettinger
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38789>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com