pytz question: GMT vs. UTC

Dan Sommers dan at tombstonezero.net
Fri Jan 31 01:28:58 EST 2014


On Fri, 31 Jan 2014 04:37:16 +0000, Steven D'Aprano wrote:

> On Fri, 31 Jan 2014 04:08:46 +0000, Dan Sommers wrote about temperatures:
> 
>> And -1 K.
> 
> You josh, but there are negative temperatures in Kelvin. They're hotter 
> than infinitely hot.
> 
> http://en.wikipedia.org/wiki/Negative_temperature

That's what I get for stopping with an undergraduate degree in physics.

Thanks for the link; I learned something interesting today.

ObPython:  My program retrieves temperatures (in Kelvins) from an
external device (the details of which I am not at liberty to discuss)
and stores them in the cloud (because that's where all the cool kids
store data these days), and there's something really weird going on.

Here's my code and the output, filtered through http://sscce.org/:

    $ cat ./program.py

    import cloudstorageinterface

    temperature1 = cloudstorageinterface.get_a_temperature()
    temperature2 = cloudstorageinterface.get_a_temperature()

    print('temperature1 is', temperature1, 'K')
    print('temperature2 is', temperature2, 'K')

    if temperature2 > temperature1:
	print('temperature2 is hotter than temperature1')

    if temperature2 < temperature1:
	print('temperature1 is hotter than temperature2')

    if temperature2 == temperature1:
	print("this can't happen")

    $ python ./program.py
    temperature1 is -100 K
    temperature2 is 100 K
    temperature2 is hotter than temperature1

But everyone knows that -100K is hotter than 100K.  I tried converting
to UTC, but that didn't help.  What am I missing?



More information about the Python-list mailing list