from typing import Any
from typing import Callable
from typing import cast
+from typing import Container
from typing import Dict
from typing import FrozenSet
from typing import Generic
return list(x)
-def has_intersection(set_: Union[Set[Any], FrozenSet[Any]], iterable: Iterable[Any]) -> bool:
+def has_intersection(set_: Container[Any], iterable: Iterable[Any]) -> bool:
r"""return True if any items of set\_ are present in iterable.
Goes through special effort to ensure __hash__ is not called
on items in iterable that don't support it.
"""
- # TODO: optimize, write in C, etc.
return any(i in set_ for i in iterable if i.__hash__)