A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-September/149404.html below:

[Python-Dev] PEP 557: Data Classes

[Python-Dev] PEP 557: Data ClassesMike Miller python-dev at mgmiller.net
Fri Sep 8 18:20:46 EDT 2017
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:

   https://docs.djangoproject.com/en/dev/topics/db/models/

- Perhaps mention Kivy Properties, as prior art:

   https://kivy.org/docs/api-kivy.properties.html


- 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.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4