[issue33474] Support immutability per-field in dataclasses

2018-05-14 Thread Daniel Lindeman
Daniel Lindeman added the comment: A possible use case would be a field that represents an auto-incrementing database ID. Since the field is auto-incrementing in the database, it would be desirable to keep this field frozen, and others mutable once an instance of a data class is created. Th

[issue33474] Support immutability per-field in dataclasses

2018-05-13 Thread Eric V. Smith
Eric V. Smith added the comment: Can you explain your use case for this? Also, how do you envision this working with the existing frozen, hashing, and equality behavior? There are a lot of interactions there, and we'd want to do something that makes sense holistically, and isn't likely to cau

[issue33474] Support immutability per-field in dataclasses

2018-05-12 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> eric.smith components: +Library (Lib) versions: +Python 3.8 -Python 3.7 ___ Python tracker ___ ___

[issue33474] Support immutability per-field in dataclasses

2018-05-12 Thread Daniel Lindeman
New submission from Daniel Lindeman : Currently, all fields in dataclasses can be frozen by passing frozen=True to the decorator. There are cases where it would be useful to have some fields be mutable, and others immutable. By using a strategy similar to how the decorator frozen works, using