[Python-Dev] PEP 557: Data Classes (original) (raw)
Mike Miller python-dev at mgmiller.net
Fri Sep 8 18:20:46 EDT 2017
- Previous message (by thread): [Python-Dev] PEP 557: Data Classes
- Next message (by thread): [Python-Dev] PEP 557: Data Classes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2017-09-08 07:57, Eric V. Smith wrote:
I've written a PEP for…
Apologies for the following list dumb questions and bikesheds:
'Classes can be thought of as "mutable namedtuples with defaults".'
- A C/C++ (struct)ure sounds like a simpler description that many more would understand.
dataclass name:
- class, redundant
- data, good but very common
- struct, used?
- Record? (best I could come up with)
Source needs blanks between functions, hard to read.
Are types required?
Maybe an example or two with Any?
Intro discounts inheritance and metaclasses as "potentially interfering", but unclear why that would be the case. Inheritance is easy to override, metaclasses not sure?
Perhaps mention ORMs/metaclass approach, as prior art:
Perhaps mention Kivy Properties, as prior art:
For mutable default values:
@dataclass class C: x: list # = field(default_factory=list) Could it detect list as a mutable class "type" and set it as a factory automatically?
The PEP/bug #3 mentions using copy, but that's not exactly what I'm asking above.
- Previous message (by thread): [Python-Dev] PEP 557: Data Classes
- Next message (by thread): [Python-Dev] PEP 557: Data Classes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]