question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: dtype comparison coerces generously leading to problems hashes

See original GitHub issue

For some reason, dtype objects and the numpy types they are based off of compare equal. They don’t hash equal of course, which goes against Python’s docs that say

The only required property is that objects which compare equal have the same hash value…

Can we make them compare unequal? Is there any reason for them to compare equal?

In [6]: np.dtype(np.float) == np.float
Out[6]: True

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
shoyercommented, May 7, 2019

Yes, I think so? I imagine I was contemplating this as something to consider for an eventual API cleanup.

0reactions
mattipcommented, May 7, 2019

@shoyer did you reopen this intentionally?

Read more comments on GitHub >

github_iconTop Results From Across the Web

BUG: Weird behavior for comparison operations `eq` and `ne ...
Looks like the problem is related to size of operands for comparison operations. Could anyone explain please? Is it normal behavior?
Read more >
Why do these dtypes compare equal but hash different?
My workaround for this problem is to call np.dtype on everything, after which hash values and comparisons are consistent. python · numpy.
Read more >
pybind11 Documentation - Read the Docs
pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python.
Read more >
Nmap Change Log
The bug was reported by Daniel Miller. [Zenmap]It is now possible to compare scans having the same name or command line parameters. [Jah,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found