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-November/150838.html below:

[Python-Dev] Second post: PEP 557, Data Classes

[Python-Dev] Second post: PEP 557, Data ClassesEric V. Smith eric at trueblade.com
Sat Nov 25 16:06:20 EST 2017
The updated version should show up at 
https://www.python.org/dev/peps/pep-0557/ shortly.

The major changes from the previous version are:

- Add InitVar to specify initialize-only fields.
- Renamed __dataclass_post_init__() to __post_init().
- Rename cmp to compare.
- Added eq, separate from compare, so you can test
   unorderable items for equality.
- Flushed out asdict() and astuple().
- Changed replace() to just call __init__(), and dropped
   the complex post-create logic.

The only open issues I know of are:
- Should object comparison require an exact match on the type?
   https://github.com/ericvsmith/dataclasses/issues/51
- Should the replace() function be renamed to something else?
   https://github.com/ericvsmith/dataclasses/issues/77

Most of the items that were previously discussed on python-dev were 
discussed in detail at https://github.com/ericvsmith/dataclasses. Before 
rehashing an old discussion, please check there first.

Also at https://github.com/ericvsmith/dataclasses is an implementation, 
with tests, that should work with 3.6 and 3.7. The only action item for 
the code is to clean up the implementation of InitVar, but that's 
waiting for PEP 560. Oh, and if PEP 563 is accepted I'll also need to do 
some work.

Feedback is welcomed!

Eric.
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