[Python-Dev] PEP 557: Data Classes (original) (raw)
Michel Desmoulin desmoulinmichel at gmail.com
Sun Sep 10 10:00:37 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 ]
The reaction is overwhelmingly positive everywhere: hacker news, reddit, twitter.
People have been expecting something like that for a long time.
3 questions:
is providing validation/conversion hooks completely out of the question of still open for debate ? I know it's to keep the implementation simple but have a few callbacks run in the init in a foo loop is not that much complexity. You don't have to provide validators, but having a validators parameters on field() would be a huge time saver. Just a list of callables called when the value is first set, potentially raising an exception that you don't even need to process in any way. It returns the value converted, and voilĂ . We all do that every day manually.
I read Guido talking about some base class as alternative to the generator version, but don't see it in the PEP. Is it still considered ?
any chance it becomes a built in later ? When classes have been improved in Python 2, the object built-in was added. Imagine if we had had to import it every time... Or maybe just plug it to object like @object.dataclass.
- 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 ]