This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Darrick Yee
Recipients Darrick Yee
Date 2020-05-27.17:23:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1590600197.98.0.468559404003.issue40796@roundup.psfhosted.org>
In-reply-to
Content
https://docs.python.org/3/library/dataclasses.html#module-dataclasses

`make_dataclass` takes a `field` parameter, which is an iterable whose entries may be tuples of `(name, type)` or `(name, type, dataclasses.Field)`.  However, an exception is thrown if such tuples are provided in a particular order.  Example:


from dataclasses import field, make_dataclass

fieldspec1 = ('field1', str)
fieldspec2 = ('field2', str, field(default='Hello'))

MyDc1 = make_dataclass('MyDc1', [fieldspec1, fieldspec2]) # Ok
MyDc2 = make_dataclass('MyDc2', [fieldspec2, fieldspec1]) # TypeError

I am guessing this is not intentional...
History
Date User Action Args
2020-05-27 17:23:18Darrick Yeesetrecipients: + Darrick Yee
2020-05-27 17:23:17Darrick Yeesetmessageid: <1590600197.98.0.468559404003.issue40796@roundup.psfhosted.org>
2020-05-27 17:23:17Darrick Yeelinkissue40796 messages
2020-05-27 17:23:17Darrick Yeecreate