Created
September 23, 2017 18:25
-
-
Save tejuafonja/31dd476843d30fb671cc9c902bdc2df0 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
# python 2.7 | |
class Celsius(object): | |
def __init__(self, temperature = 0): | |
self.temperature = temperature | |
def to_fahrenheit(self): | |
return (self.temperature * 1.8) + 32 | |
@property | |
def temperature(self): | |
print("Getting value") | |
return self._temperature | |
@temperature.setter | |
def temperature(self, value): | |
if value < -273: | |
raise ValueError("Temperature below -273 is not possible") | |
print("Setting value") | |
self._temperature = value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[source] Dash ~ google