Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f87293 commit 80d21afCopy full SHA for 80d21af
1 file changed
Lib/sets.py
@@ -280,13 +280,14 @@ def _compute_hash(self):
280
281
def _update(self, iterable):
282
# The main loop for update() and the subclass __init__() methods.
283
- # XXX This can be optimized a bit by first trying the loop
284
- # without setting up a try/except for each element.
285
data = self._data
286
value = True
287
- for element in iterable:
+ it = iter(iterable)
+ while True:
288
try:
289
- data[element] = value
+ for element in it:
+ data[element] = value
290
+ return
291
except TypeError:
292
transform = getattr(element, "_as_immutable", None)
293
if transform is None:
0 commit comments