<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 5, 2018 at 3:37 PM, Steven D'Aprano <span dir="ltr"><<a href="mailto:steve@pearwood.info" target="_blank">steve@pearwood.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On Sun, Feb 04, 2018 at 09:18:25PM -0800, Guido van Rossum wrote:<br>
<br>
> The way I think of it generally is that immutability is a property of<br>
> types, while hashability is a property of values.<br>
<br>
</span>That's a great way to look at it, thanks.<br></blockquote><div><br></div><div>hmm -- maybe we should get a ValueError then when you try to use a non-hashable value?</div><div><br></div><div>







<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>9</b></span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">]: </span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">t = ([</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">1</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">,</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">2</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">,</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">3</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">],) <span class="gmail-Apple-converted-space">   </span></span></p>
<p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p3" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>10</b></span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">]: set</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">(t)</span></p>
<p class="gmail-p4" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(195,55,32);background-color:rgb(255,255,255)"><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">---------------------------------------------------------------------------</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">TypeError</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures"> <span class="gmail-Apple-converted-space">                                </span>Traceback (most recent call last)</span></p>
<p class="gmail-p5" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,188,38);background-color:rgb(255,255,255)"><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures"><ipython-input-10-a2fddf4dafd8></span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> in </span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(51,187,200)"><module></span><span class="gmail-s7" style="font-variant-ligatures:no-common-ligatures;color:rgb(82,48,225)">()</span></p>
<p class="gmail-p5" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,188,38);background-color:rgb(255,255,255)"><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">----> 1</span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)"> </span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">set</span><span class="gmail-s7" style="font-variant-ligatures:no-common-ligatures;color:rgb(82,48,225)">(</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">t</span><span class="gmail-s7" style="font-variant-ligatures:no-common-ligatures;color:rgb(82,48,225)">)</span></p>
<p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">TypeError</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">: unhashable type: 'list'</span></p></div><div><br></div><div><br></div><div>Of course, in this case, the error is triggered by the type of the zeroth element of the tuple, not by the  value of the tuple per se.</div><div><br></div><div>Which means that hashability really is a property of type -- but container types require a specific way of thinking -- hashability is not determined by the type of the container (or may not be), but by the types of it's contents. Is that the value of the container?</div><div><br></div><div>So maybe: an object is hashable if it is a hashable type, and if it is a container, if it's contents are hashable types.</div><div><br></div><div><br></div><div>With dataclasses as they stand -- it seems the values of the fields does not affect hashability:</div><div><br></div><div>(this is the version 0.4 from PyPi -- disregard if it's out of date)</div><div><br></div><div>Unhashable by default:</div><div><br></div><div>







<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>14</b></span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">]: </span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(208,59,255)">@dataclasses</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures">.dataclass()</span></p>
<p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>...: <b>class</b></span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(60,159,242)"><b>NoHash</b></span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">:</span></p>
<p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>...: </span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"><span class="gmail-Apple-converted-space">    </span>x = </span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures">5</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)"><span class="gmail-Apple-converted-space">    </span>...: </span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>l = [</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">1</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures">,</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">2</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures">,</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">3</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures">]</span></p>
<p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>...:<span class="gmail-Apple-converted-space"> </span></span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> <span class="gmail-Apple-converted-space">   </span></span></p>
<p class="gmail-p3" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>15</b></span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures">]: set</span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">((nh,))</span></p>
<p class="gmail-p4" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(195,55,32);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures">---------------------------------------------------------------------------</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s7" style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">TypeError</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures"> <span class="gmail-Apple-converted-space">                                </span>Traceback (most recent call last)</span></p>
<p class="gmail-p5" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,188,38);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures"><ipython-input-15-80dc23ed0b24></span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> in </span><span class="gmail-s8" style="font-variant-ligatures:no-common-ligatures;color:rgb(51,187,200)"><module></span><span class="gmail-s9" style="font-variant-ligatures:no-common-ligatures;color:rgb(82,48,225)">()</span></p>
<p class="gmail-p5" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,188,38);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures">----> 1</span><span class="gmail-s7" style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)"> </span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">set</span><span class="gmail-s9" style="font-variant-ligatures:no-common-ligatures;color:rgb(82,48,225)">((</span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">nh</span><span class="gmail-s9" style="font-variant-ligatures:no-common-ligatures;color:rgb(82,48,225)">,))</span></p>
<p class="gmail-p3" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s7" style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">TypeError</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures">: unhashable type: 'NoHash'</span></p><p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures"><br></span></p><p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures"><br></span></p>OK, that's what we expect.<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures"><br></span></p><br>But then if it is hashable:</div><div><br><p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>19</b></span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">]: </span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(208,59,255)">@dataclasses</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">.dataclass(</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">hash</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">=</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><b>True</b></span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">)</span></p><p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>...: <b>class</b></span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> </span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(60,159,242)"><b>Hash</b></span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">:</span></p><p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>...: </span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"><span class="gmail-Apple-converted-space">    </span>x = </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">5</span></p><p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)"><span class="gmail-Apple-converted-space">    </span>...: </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>l = [</span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">1</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">,</span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">2</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">,</span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">3</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">]</span></p><p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">    </span>...:<span class="gmail-Apple-converted-space"> </span></span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> <span class="gmail-Apple-converted-space">   </span></span></p><p class="gmail-p3" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p><p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>20</b></span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">]: </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">h = Hash()</span></p><p class="gmail-p3" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p><p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>21</b></span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">]: set</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">((h,))</span></p><p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures">
















</span></p><p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s7" style="font-variant-ligatures:no-common-ligatures;color:rgb(178,54,34)">Out[</span><span class="gmail-s8" style="font-variant-ligatures:no-common-ligatures;color:rgb(255,59,30)"><b>21</b></span><span class="gmail-s7" style="font-variant-ligatures:no-common-ligatures;color:rgb(178,54,34)">]: </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">{Hash()}</span></p><p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures"><br></span></p><br>All works, regardless of the values of the fields</div><div><br></div><div>I haven't looked at the code -- but it appears the hash has nothing to do with the values of the fields:</div><div><br></div><div>







<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>23</b></span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">]: hash</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">(h)</span></p>
<p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(178,54,34)">Out[</span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(255,59,30)"><b>23</b></span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(178,54,34)">]: </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">3527539</span></p>
<p class="gmail-p3" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>24</b></span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">]: </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">h.l.append(</span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">6</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">)</span></p>
<p class="gmail-p3" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>25</b></span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">]: hash</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">(h)</span></p>
<p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(178,54,34)">Out[</span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(255,59,30)"><b>25</b></span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(178,54,34)">]: </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">3527539</span></p>
<p class="gmail-p3" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>26</b></span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">]: </span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">h.x = </span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">7</span></p>
<p class="gmail-p3" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>27</b></span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">]: hash</span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">(h)</span></p>
<p class="gmail-p4" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(178,54,34);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">Out[</span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(255,59,30)"><b>27</b></span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">]: </span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">3527539</span></p></div><div><br></div><div>and it looks like all instances hash the same:</div><div><br></div><div>







<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>31</b></span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">]: </span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">h2 = Hash()</span></p>
<p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p3" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>32</b></span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">]: hash</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">(h2)</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(178,54,34)">Out[</span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(255,59,30)"><b>32</b></span><span class="gmail-s5" style="font-variant-ligatures:no-common-ligatures;color:rgb(178,54,34)">]: </span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">3527539</span></p>
<p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p class="gmail-p3" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,163,39);background-color:rgb(255,255,255)"><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">In [</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;color:rgb(46,231,33)"><b>33</b></span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">]: hash</span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">(h)</span></p>
<p class="gmail-p4" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(178,54,34);background-color:rgb(255,255,255)"><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">Out[</span><span class="gmail-s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(255,59,30)"><b>33</b></span><span class="gmail-s3" style="font-variant-ligatures:no-common-ligatures">]: </span><span class="gmail-s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">3527539</span></p></div><div><br></div><div>So I'm wondering how hashablility is useful at all?</div><div><br></div><div>But it sure looks like there's a lot of room for confusion and error, even if it's a frozen dataclass.</div><div><br></div><div>This may a case where we need to really make sure the docs are good!</div><div><br></div><div>-CHB</div><div><br></div><div><br></div><div><br></div></div>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            (206) 526-6959   voice<br>7600 Sand Point Way NE   (206) 526-6329   fax<br>Seattle, WA  98115       (206) 526-6317   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>