Issue #22823: Use set literals instead of creating a set from a list

This commit is contained in:
Raymond Hettinger 2014-11-09 15:56:33 -08:00
parent bf764a1912
commit df1b699447
10 changed files with 19 additions and 20 deletions

View file

@ -150,7 +150,7 @@ def _sum(data, start=0):
# We fail as soon as we reach a value that is not an int or the type of
# the first value which is not an int. E.g. _sum([int, int, float, int])
# is okay, but sum([int, int, float, Fraction]) is not.
allowed_types = set([int, type(start)])
allowed_types = {int, type(start)}
n, d = _exact_ratio(start)
partials = {d: n} # map {denominator: sum of numerators}
# Micro-optimizations.
@ -168,7 +168,7 @@ def _sum(data, start=0):
assert allowed_types.pop() is int
T = int
else:
T = (allowed_types - set([int])).pop()
T = (allowed_types - {int}).pop()
if None in partials:
assert issubclass(T, (float, Decimal))
assert not math.isfinite(partials[None])