Re: [Python-Dev] Immutability vs. hashability

2018-02-12 Thread Chris Barker
On Mon, Feb 5, 2018 at 5:17 PM, Steven D'Aprano wrote: > I'm not happy about the concept of pandering to the least capable, most > ignorant programmers by baking a miscomprehension into an important > standard library API. I don't think this is "baking a miscomprehension",

Re: [Python-Dev] Immutability vs. hashability

2018-02-12 Thread Chris Barker
I don't seem to be getting my own messages back to reply to, but: yes, of course, dataclasses won't hash if a field is mutable: In [*58*]: @dataclasses.dataclass(hash=*True*, frozen=*True*) ...: *class* *Hash*: ...: x: int = 5 ...: l: list =

Re: [Python-Dev] Immutability vs. hashability

2018-02-12 Thread Chris Barker
On Mon, Feb 5, 2018 at 3:37 PM, Steven D'Aprano wrote: > On Sun, Feb 04, 2018 at 09:18:25PM -0800, Guido van Rossum wrote: > > > The way I think of it generally is that immutability is a property of > > types, while hashability is a property of values. > > That's a great way

Re: [Python-Dev] Immutability vs. hashability

2018-02-05 Thread Steven D'Aprano
On Mon, Feb 05, 2018 at 12:09:52AM -0600, Chris Barker wrote: > But a bit more detail -- I'm commenting on the API, not the capability - > that is, since users often equate hashable and immutability, they will > expect that if they say hash=True, then will get an immutable, and if they > say

Re: [Python-Dev] Immutability vs. hashability

2018-02-05 Thread Steven D'Aprano
On Sun, Feb 04, 2018 at 09:18:25PM -0800, Guido van Rossum wrote: > The way I think of it generally is that immutability is a property of > types, while hashability is a property of values. That's a great way to look at it, thanks. -- Steve ___

Re: [Python-Dev] Immutability vs. hashability

2018-02-05 Thread Antoine Pitrou
On Sun, 4 Feb 2018 14:31:06 -0800 Guido van Rossum wrote: > On Sun, Feb 4, 2018 at 11:59 AM, Chris Barker - NOAA Federal < > chris.bar...@noaa.gov> wrote: > > > I think the folks that are concerned about this issue are quite right > > — most Python users equate immutable and

Re: [Python-Dev] Immutability vs. hashability

2018-02-04 Thread Chris Barker
On Sun, Feb 4, 2018 at 7:54 PM, Nick Coghlan wrote: > On 5 February 2018 at 08:31, Guido van Rossum wrote: > > On Sun, Feb 4, 2018 at 11:59 AM, Chris Barker - NOAA Federal > > wrote: > >> > >> I think the folks that are concerned

Re: [Python-Dev] Immutability vs. hashability

2018-02-04 Thread Guido van Rossum
That's a lot to read between the lines. I was unhappy that Chris took the statement that immutability and hashability are equivalent, claimed that most people think of it that way, and did not point out that it was false, thereby making the impression that he wasn't aware of the difference. The

Re: [Python-Dev] Immutability vs. hashability

2018-02-04 Thread Nick Coghlan
On 5 February 2018 at 08:31, Guido van Rossum wrote: > On Sun, Feb 4, 2018 at 11:59 AM, Chris Barker - NOAA Federal > wrote: >> >> I think the folks that are concerned about this issue are quite right >> — most Python users equate immutable and