[issue28071] Stop set.difference when set is empty

2019-06-10 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Behavior change in msg306973 is tracked with issue37219 -- nosy: +xtreak ___ Python tracker ___ ___

[issue28071] Stop set.difference when set is empty

2017-11-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This optimization caused a behavior change: Python 3.5: >>> set().difference([[]]) Traceback (most recent call last): File "", line 1, in TypeError: unhashable type: 'list' Python 3.6: >>> set().difference([[]]) set() -- __

[issue28071] Stop set.difference when set is empty

2016-09-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: I only want a single quick check upfront. It doesn't make much sense to put this in the inner loop. -- resolution: -> fixed status: open -> closed ___ Python tracker

[issue28071] Stop set.difference when set is empty

2016-09-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue28071] Stop set.difference when set is empty

2016-09-11 Thread Terry J. Reedy
Terry J. Reedy added the comment: The patch covers sets that start empty, but not sets that become empty during iteration. Are you thinking about or rejecting the latter? (And should this then be closed?) -- resolution: fixed -> status: closed -> open __

[issue28071] Stop set.difference when set is empty

2016-09-11 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue28071] Stop set.difference when set is empty

2016-09-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset fa0af1a6344d by Raymond Hettinger in branch 'default': Issue #28071: Add early-out for differencing from an empty set. https://hg.python.org/cpython/rev/fa0af1a6344d -- nosy: +python-dev ___ Python tracke

[issue28071] Stop set.difference when set is empty

2016-09-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: New timings look nice: $ py -m timeit -s "r = range(10 ** 4); s = set()" "s.difference(r)" 1000 loops, best of 3: 0.104 usec per loop $ py -m timeit -s "r = set(range(10 ** 4)); s = set()" "s.difference(r)" 1000 loops, best of 3: 0.1

[issue28071] Stop set.difference when set is empty

2016-09-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: This is reasonable, cheap, and not hard to do. I'll whip-up a patch shortly. -- ___ Python tracker ___

[issue28071] Stop set.difference when set is empty

2016-09-11 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue28071] Stop set.difference when set is empty

2016-09-10 Thread Terry J. Reedy
New submission from Terry J. Reedy: Proposal from SO: in the iteration loop for 'myset.difference(iterable)', add equivalent of "if not myset: break'. https://stackoverflow.com/questions/39378043/why-does-pythons-set-difference-method-take-time-with-an-empty-set In the toy example for testing t