Mark turner <mturner...@gmail.com> added the comment:
I tried a couple of the examples from the docs and found the setup to be a little confusing amd inconsistent. For example, the decorator line "@decorator" requires you to use from dataclasses import dataclass while the example line "mylist: List[int] = field(default_factory=list)" requires you to use these import dataclasses import typing and must be modified to mylist: typing.List[int] = dataclasses.field(default_factory=list) The decorator line could be modified to be @dataclasses.dataclass and the from/import line could be eliminated. But that seems awkward. So, what is are best practices for handling the imports needed by these examples? And should the examples be updated to be consistent with a best practice set of imports? Or am I not understanding how this code works? Also, the intro section states "If any of the added methods already exist on the class, a TypeError will be raised." This statement seems incorrect and contrdicts the parameter documentation that follows. ---------- nosy: +mturner865 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36661> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com