Counter that remembers the order elements are first encountered
| 452 | |
| 453 | |
| 454 | class OrderedCounter(Counter, OrderedDict): |
| 455 | 'Counter that remembers the order elements are first encountered' |
| 456 | |
| 457 | def __repr__(self): |
| 458 | return '%s(%r)' % (self.__class__.__name__, OrderedDict(self)) |
| 459 | |
| 460 | def __reduce__(self): |
| 461 | return self.__class__, (OrderedDict(self),) |
| 462 | |
| 463 | class MySet(set): # Override repr of a basic type |
| 464 | def __repr__(self): |
no outgoing calls