Created
August 15, 2014 20:04
-
-
Save Hamatti/3391fc4bd3565b3143b7 to your computer and use it in GitHub Desktop.
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 A(object): | |
| def __init__(self, key, value): | |
| self.key = key | |
| self.value = value | |
| @property | |
| def double_value(self): | |
| return self.value * 2 | |
| alpha = A('hello', 2) | |
| print alpha.key # prints 'hello' | |
| print alpha.value # prints 2 | |
| print alpha.double_value # prints 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment