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
>>> seq_x = [1, 2, 3, 4] | |
>>> seq_y = 'abc' | |
>>> [(x,y) for x in seq_x for y in seq_y] | |
1: [(1, 'a'), | |
(1, 'b'), | |
(1, 'c'), | |
(2, 'a'), | |
(2, 'b'), | |
(2, 'c'), | |
(3, 'a'), |
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
class SingletonType(type): | |
def __call__(cls, *args, **kwargs): | |
try: | |
return cls.__instance | |
except AttributeError: | |
cls.__instance = super(SingletonType, cls).__call__(*args, **kwargs) | |
return cls.__instance |
NewerOlder