isi-vista / immutablecollections

A library for immutable collections, in the spirit of Guava's Immutable Collections.
MIT License
3 stars 1 forks source link

Add missing set/frozenset methods to ImmutableSet #61

Closed berquist closed 4 years ago

berquist commented 4 years ago
berquist commented 4 years ago

@rgabbard From just below https://docs.python.org/3/library/stdtypes.html#frozenset.copy:

Note, the non-operator versions of union(), intersection(), difference(), and
symmetric_difference(), issubset(), and issuperset() methods will accept any
iterable as an argument. In contrast, their operator based counterparts
require their arguments to be sets. This precludes error-prone constructions
like set('abc') & 'cbs' in favor of the more readable
set('abc').intersection('cbs').

Should we follow this convention? Even though our union doesn't right now

    def union(
        self, other: AbstractSet[T], check_top_type_matches: Optional[Type[T]] = None
    ) -> "ImmutableSet[T]":

I think we should.

gabbard commented 4 years ago

@berquist : I agree.