Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-19 Thread Chris Barker - NOAA Federal
If I have this right, on the discussion about frozen and hash, a use case was brought up for taking a few steps to create an instance (and thus wanting it not frozen) and then wanting it hashable. Which pointed to the idea of a “ freeze this from now on” method. This seems another use case — mayb

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-19 Thread Guido van Rossum
But how? On Mon, Feb 19, 2018 at 5:06 PM, Chris Barker - NOAA Federal < chris.bar...@noaa.gov> wrote: > If I have this right, on the discussion about frozen and hash, a use > case was brought up for taking a few steps to create an instance (and > thus wanting it not frozen) and then wanting it ha

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-19 Thread Chris Barker - NOAA Federal
But how? Well, I hadn’t thought that far ;-) But it would make frozen an instance level property, rather than a class-level one — some instances would be frozen, some not. Which would be kinda compatible with the idea of hashability being a property of values, rather than type. Frozen-ness woul

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-19 Thread Glenn Linderman
On 2/19/2018 7:02 PM, Guido van Rossum wrote: But how? On Mon, Feb 19, 2018 at 5:06 PM, Chris Barker - NOAA Federal mailto:chris.bar...@noaa.gov>> wrote: ... maybe it would be helpful to be able to freeze an instance after creation for multiple use-cases? And there's the crux of th

Re: [Python-Dev] Dataclasses, frozen and __post_init__

2018-02-19 Thread Steven D'Aprano
On Mon, Feb 19, 2018 at 07:02:42PM -0800, Guido van Rossum wrote: > On Mon, Feb 19, 2018 at 5:06 PM, Chris Barker - NOAA Federal < > chris.bar...@noaa.gov> wrote: [...] > > This seems another use case — maybe it would be helpful to be able to > > freeze an instance after creation for multiple use-