• Stefan Pasteiner
    Stefan Pasteiner
    2015-04-15

    Ich weis zwar nicht was die funktion hash() macht. Aber auf jeden fall ist sowohl hash(-1) also auch hash(-2) bei mir in der python konsole -2

    0
  • dosius naked
    dosius naked
    2015-04-15

    Wild guess: negative zahlen hashen ist nicht erlaubt, darum wird -2 als return code zurückgegeben, was häufig eine Errormeldung ist.

    Auflösung erbeten :-)

    0
  • Brad Koehn ☑️
    Brad Koehn ☑️
    2015-04-15

    I'll guess that it's because Python's hash() function kind of sucks. I'm not sure why, but I also don't write Python. In Java, Integer.hashCode(i) == i. That seems straightforward.

    0
  • c0der@pod.orkz.net
    c0der@pod.orkz.net
    2015-04-15

    http://stackoverflow.com/questions/10130454/why-do-1-and-2-both-hash-to-2-in-python

    0