Skip to content

Conversation

@ischurov
Copy link
Contributor

@ischurovischurov commented Feb 10, 2023

Updated docstrings of astuple and asdict to reflect that they deep copy objects in the field values, according to the changes in the docs (see #26154 and #88071).

I believe that this behaviour of astuple and asdict is rather counter-intuitive and it is important to inform the developer about it in the docstring. (I personally spent half an hour trying to fix a bug that appeared because I wasn't aware of it.)

…ct that they deep copy objects in the field values, according to the changes in the docs, see python#26154
@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@ghost
Copy link

ghost commented Feb 10, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@arhadthedevarhadthedev added the stdlib Standard Library Python modules in the Lib/ directory label Feb 10, 2023
@hauntsaninjahauntsaninja changed the title gh-88071: Update docstringsgh-88071: Update docstrings of dataclass' astuple and asdictFeb 19, 2023
Copy link
Member

@carljmcarljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to mention this in the docstring as well as the docs; change LGTM.

@carljmcarljm merged commit 767d3a8 into python:mainMar 11, 2023
iritkatriel pushed a commit to iritkatriel/cpython that referenced this pull request Mar 12, 2023
…ython#101806) Update dataclasses.astuple and dataclasses.asdict docstrings to reflect that they deep copy objects in the field values.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newsstdlibStandard Library Python modules in the Lib/ directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@ischurov@bedevere-bot@carljm@arhadthedev@hauntsaninja