mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #22823: Use set literals instead of creating a set from a list
This commit is contained in:
parent
bf764a1912
commit
df1b699447
10 changed files with 19 additions and 20 deletions
|
@ -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])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue