Why the KeyError?

Aahz Maruch aahz at panix.com
Fri Oct 6 15:47:35 EDT 2000


In article <Pine.SOL.3.96.1001006104916.28030B-100000 at condor.ee.washington.edu>,
Steve Juranich  <sjuranic at condor.ee.washington.edu> wrote:
>
>Which _clearly_ shows that 5.77 IS one of the keys.  Could anybody please
>explain to me why I'm getting this error?  Could it be that I'm using floats
>as dictionary keys?  I know that the internal representation of them is
>kinda dodgy.  Is there a way around this, or should I just re-index using
>ints?

Bingo!  Yes, use ints.  Use long ints if necessary.  Never, never, never
index by floats.
-- 
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

There's a difference between a person who gets shit zie doesn't
deserve and a person who gets more shit than zie deserves.  --Aahz



More information about the Python-list mailing list