Skip to content

Commit

Permalink
As order is unimportant for Projection._keys, prefer set instead for …
Browse files Browse the repository at this point in the history
…efficiency.
  • Loading branch information
jaraco committed Mar 28, 2023
1 parent c160d00 commit 71a9ba7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jaraco/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Projection(collections.abc.Mapping):
"""

def __init__(self, keys, space):
self._keys = tuple(keys)
self._keys = set(keys)
self._space = space

def __getitem__(self, key):
Expand All @@ -57,7 +57,7 @@ def __getitem__(self, key):
return self._space[key]

def _keys_resolved(self):
return set(self._keys).intersection(self._space)
return self._keys.intersection(self._space)

def __iter__(self):
return iter(self._keys_resolved())
Expand Down

0 comments on commit 71a9ba7

Please sign in to comment.