🤷♂️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ComparableMixin: | |
def __eq__(self, other): | |
return not (self < other or other < self) | |
def __le__(self, other): | |
return not other < self | |
class Foo(ComparableMixin): | |
def __init__(self, val): | |
self.val = val |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import timeit | |
from copy import deepcopy | |
def inter_reduce(sets): | |
return reduce(set.intersection, sets) | |
def inter_for_deepcopy(sets): | |
sets = iter(sets) | |
result = deepcopy(next(sets)) |
NewerOlder