Created
May 17, 2014 09:25
-
-
Save curzona/d3003d82812b2df1bc07 to your computer and use it in GitHub Desktop.
Python flatten implementation from p4python
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
| def __flatten(self, args): | |
| result = [] | |
| if isinstance(args, tuple) or isinstance(args, list): | |
| for i in args: | |
| result.extend(self.__flatten(i)) | |
| else: | |
| result.append(args) | |
| return tuple(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment