https://github.com/python/cpython/commit/0d5455fc7fa921b56d1f4cbdc89e1ba9036c2cd8 commit: 0d5455fc7fa921b56d1f4cbdc89e1ba9036c2cd8 branch: 3.12 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: ericvsmith <ericvsm...@users.noreply.github.com> date: 2024-03-09T17:08:12-05:00 summary:
[3.12] gh-116535: Fix distracting "TypeError" in example code (gh-116538) (gh-116551) gh-116535: Fix distracting "TypeError" in example code (gh-116538) (cherry picked from commit db8f423f58e336eb6180a70d9886b443d7203c2c) Co-authored-by: Declan <5962877+d...@users.noreply.github.com> files: M Doc/library/dataclasses.rst diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 020818a0812f0c..19272376e68c71 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -717,7 +717,7 @@ Using dataclasses, *if* this code was valid:: class D: x: list = [] # This code raises ValueError def add(self, element): - self.x += element + self.x.append(element) it would generate code similar to:: @@ -726,7 +726,7 @@ it would generate code similar to:: def __init__(self, x=x): self.x = x def add(self, element): - self.x += element + self.x.append(element) assert D().x is D().x _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com