[issue36662] asdict/astuple Dataclass methods

2019-04-19 Thread George Sakkis
George Sakkis added the comment: > I think the best thing to do is write another decorator that adds this > method. I've often thought that having a dataclasses_tools third-party module > would be a good idea. I'd be happy with a separate decorator in the standard library for adding these m

[issue36662] asdict/astuple Dataclass methods

2019-04-19 Thread Eric V. Smith
Eric V. Smith added the comment: I think the best thing to do is write another decorator that adds this method. I've often thought that having a dataclasses_tools third-party module would be a good idea. It could include my add_slots decorator in https://github.com/ericvsmith/dataclasses/blo

[issue36662] asdict/astuple Dataclass methods

2019-04-19 Thread Stéphane Wirtel
Change by Stéphane Wirtel : -- nosy: +matrixise ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue36662] asdict/astuple Dataclass methods

2019-04-18 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: asdict method in the benchmark does a direct dictionary construction. Meanwhile dataclasses.asdict does more work in https://github.com/python/cpython/blob/e8113f51a8bdf33188ee30a1c038a298329e7bfa/Lib/dataclasses.py#L1023 . Hence in the example i.a

[issue36662] asdict/astuple Dataclass methods

2019-04-18 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +eric.smith, rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue36662] asdict/astuple Dataclass methods

2019-04-18 Thread George Sakkis
New submission from George Sakkis : I'd like to propose two new optional boolean parameters to the @dataclass() decorator, `asdict` and `astuple`, that if true, the respective methods are generated as equivalent to the module-level namesake functions. In addition to saving an extra imported na