| 694 | |
| 695 | # Implements the Set protocol without explicitly inheriting from collections.abc.Set. |
| 696 | class BareSetLike: |
| 697 | def __init__(self, *args): |
| 698 | self.data = set(args) |
| 699 | |
| 700 | def __len__(self): |
| 701 | return len(self.data) |
| 702 | |
| 703 | def __contains__(self, item): |
| 704 | return item in self.data |
| 705 | |
| 706 | def __iter__(self): |
| 707 | yield from self.data |
| 708 | |
| 709 | # Implements the Set protocol by reusing BareSetLike's implementation. |
| 710 | # Additionally, inherits from collections.abc.Set. |
no outgoing calls