String negative indices?

Filip Wasilewski filipwasilewski at gmail.com
Sat Jun 24 08:36:17 EDT 2006


Steven D'Aprano wrote:
> On Fri, 23 Jun 2006 02:17:39 -0700, Filip Wasilewski wrote:
>
> > drtimhill at comcast.net wrote:
> >
> >> Logically, I should be able to enter x[-2:-0] to get the last and next to last characters. However, since Python doesn't distinguish between positive and negative zero, this doesn't work. Instead, I have to enter x[-2:].
> >
> > Hooray! Logically there is no such thing as positive or negative zero,
> > or did I miss something in the primary?
>
> No, not in the primary, or even in the secondary, but possibly in the
> tertiary.
>
> For many purposes, it doesn't make sense to distinguish +0 from -0. But
> for other purposes, it does.

I believe you will agree that this is mostly a matter of notation of
some fact rather than really trying to sign zero.
For example I use to denote numbers that approach zero from "the right
side" by x -> [0 uppercase +], which is definitely harder to type and
display in poor man's text editor than x -> +0.
Otherwise I should also rethink the meaning of positive (>0) and
negative (<0) numbers (at least where such relations are defined).

[...]

> In statistical mechanics, some systems can have negative absolute
> temperatures, including negative zero. Counter-intuitively, negative
> absolute temperatures aren't colder than absolute zero, but hotter than
> any positive temperature. So, strangely enough, a temperature of -0K is
> hotter than a infinitely hot temperature!

Yeah, this is really cool ;-)

--
Filip

"During board meeting: We have great news. Our earnings reached highest
value ever - a positive 0."




More information about the Python-list mailing list