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 Gray: | |
| def __init__(self, length): | |
| self.length = length | |
| def _gen(self, start, end, n): | |
| if n == 1: | |
| yield (start, ) | |
| yield (end, ) | |
| else: | |
| for s in Gray(n-1): |
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 Gray: | |
| def __init__(self, length): | |
| self.length = length | |
| def _right(self, n): | |
| if n == 1: | |
| yield (0,) | |
| yield (1,) | |
| else: | |
| for s in Gray(n-1): |
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 sys | |
| BAD_VERSIONS = [ | |
| (2, 4), | |
| (2, 5), | |
| (2, 6) ] | |
| TRANSLATE_TEXT = sys.version_info[:2] in BAD_VERSIONS |
NewerOlder