New submission from Darrick Yee <darrick....@gmail.com>:
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... ---------- messages: 370112 nosy: Darrick Yee priority: normal severity: normal status: open title: dataclasses.make_dataclass: Exception when called with different field orders type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40796> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com