Created
December 16, 2013 01:44
-
-
Save tkmru/7981202 to your computer and use it in GitHub Desktop.
Dict object consume some memory. Therefore if class don't have __dict__, memory consumed is restrained.You use "_slots_", you can do.
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 Color(object): | |
| __slots__ = ('r', 'g', 'b') | |
| def __init__(self, r, g, b): | |
| self.r = r | |
| self.g = g | |
| self.b = b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment