title: How can I make a python dataclass hashable?
body: <p>Say a I have a dataclass in python3. I want to be able to hash and order these objects.</p>
  <p>I only want them ordered/hashed on id.</p>
  <p>I see in the docs that I can just implement _<em>hash</em>_ and all that but I'd like to get datacalsses to do the work for me because they are intended to handle this.</p>
  <pre><code>from dataclasses import dataclass, field
  
  @dataclass(eq=True, order=True)
  class Category:
      id: str = field(compare=True)
      name: str = field(default=&quot;set this in post_init&quot;, compare=False)
  
  a = sorted(list(set([ Category(id='x'), Category(id='y')])))
  
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  TypeError: unhashable type: 'Category'
  </code></pre>