Created
November 6, 2013 16:24
-
-
Save carymrobbins/7339208 to your computer and use it in GitHub Desktop.
Subclassing tuple
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 Choice(tuple): | |
| def __new__(cls, name, description, permissions): | |
| return super(Choice, cls).__new__(cls, tuple((name, name))) | |
| def __init__(self, name, description, permissions): | |
| super(Choice, self).__init__(name, description, permissions) | |
| self.description = description | |
| self.permissions = permissions | |
| self.name = name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment