[Python-Dev] PEP 557: Data Classes

Michel Desmoulin desmoulinmichel at gmail.com
Sun Sep 10 10:00:37 EDT 2017

The reaction is overwhelmingly positive everywhere: hacker news, reddit,

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

More information about the Python-Dev mailing list