Most data classes now support hashing.

This commit is contained in:
Rapptz committed 2015-12-17 00:32:54 -05:00
1 parent 613214f197
commit 51d91c2a82
8 files changed
+38 -9

No files matched your search

+5
View File
@@ -39,6 +39,8 @@ class Colour(object):
+-----------+----------------------------------------+
| x != y | Checks if two colours are not equal. |
+-----------+----------------------------------------+
| hash(x) | Return the colour's hash. |
+-----------+----------------------------------------+
| str(x) | Returns the hex format for the colour. |
+-----------+----------------------------------------+
@@ -63,6 +65,9 @@ class Colour(object):
def __str__(self):
return '#' + format(self.value, 'x')
def __hash__(self):
return hash(self.value)
@property
def r(self):
"""Returns the red component of the colour."""