This file contains 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
#https://github.com/faif/python-patterns | |
Facade # https://github.com/faif/python-patterns/blob/master/facade.py | |
Factory Method # https://github.com/faif/python-patterns/blob/master/factory_method.py | |
MVC # https://github.com/faif/python-patterns/blob/master/mvc.py | |
Tier # https://github.com/faif/python-patterns/blob/master/3-tier.py | |
Publish/Subscribe # https://github.com/faif/python-patterns/blob/master/publish_subscribe.py |
This file contains 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
from itertools import zip_longest, islice | |
def grouper(iterable, n): | |
return zip(*[iter(iterable)] * n) | |
def grouper_longest(iterable, n, fillvalue=None): | |
return zip_longest(*[iter(iterable)] * n, fillvalue=fillvalue) | |
i0 = [] | |
i1 = [1] |