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 mturner865
Recipients Windson Yang, brett.cannon, docs@python, eric.smith, matrixise, mfisherlevine, mturner865, xtreak
Date 2019-06-24.00:07:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1561334845.35.0.979195736346.issue36661@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-06-24 00:07:25mturner865setrecipients: + mturner865, brett.cannon, eric.smith, docs@python, matrixise, Windson Yang, xtreak, mfisherlevine
2019-06-24 00:07:25mturner865setmessageid: <1561334845.35.0.979195736346.issue36661@roundup.psfhosted.org>
2019-06-24 00:07:25mturner865linkissue36661 messages
2019-06-24 00:07:25mturner865create