Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class D:
- contents = ['a', 'b', 'c']
- def __getitem__(self, x):
- return self.contents[x]
- def __contains__(self, key):
- return key in self.keys()
- def keys(self):
- return range(len(self.contents))
- assert {**D()} == {0: 'a', 1: 'b', 2: 'c'}
- assert [*D()] == ['a', 'b', 'c']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement