This is probably trivial, but I got not resolution when searching for this:
I have the following simple class:
class Celcius:
def __init__(self, temperature=0):
self.temperature = temperature
def to_fahrenheit(self):
return (self.temperature*1.8) + 32
def get_temperature(self):
print "getting temp"
return self._temperature
def set_temperature(self, value):
if value < -273:
raise ValueError("dayum u trippin' fool")
print "setting temp"
self._temperature = value
temperature = property(get_temperature, set_temperature)
c = Celcius()
When I run this in Sublime Text 3 (by hitting cmd+B) the console does not print anything. I should see:
setting temp
If I add the following to the end of the script:
print "banana"
print "apple"
both lines are printed as expected.
If I run the above python script from the terminal (with python -u, or just python), the result is exactly the same. I assume I am missing something very stupid. Thank you