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 to look at it, thanks

[Python-Dev] Apology -- ignore previous message

2018-02-12 Thread Chris Barker
Sorry -- too big a brain blip this morning.. my experiments were'n't actually creating dataclasses properly. Though it does show why the reliance on type hinting in troubling!! IGNORE that message! Sorry for the noise. -CHB On Mon, Feb 5, 2018 at 3:37 PM, Steven D'Aprano wrote: > On Sun, Fe

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 = dataclasses.field(default_fact

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", but rather adhering t