Skip to content

Commit

Permalink
Tweak SquareSet constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Jul 11, 2018
1 parent 26c0c15 commit 3698bf5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions chess/__init__.py
Expand Up @@ -3370,10 +3370,14 @@ class SquareSet(collections.abc.MutableSet):
def __init__(self, squares=BB_EMPTY):
try:
self.mask = int(squares) & BB_ALL
return
except TypeError:
self.mask = 0
for square in squares:
self.add(square)

# Try squares as an iterable. Not under except clause for nicer
# backtraces.
for square in squares:
self.add(square)

# Set

Expand Down

0 comments on commit 3698bf5

Please sign in to comment.