Skip to content

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Apr 11, 2024

{"__replace__", _PyCFunction_CAST(namespace_replace), METH_VARARGS|METH_KEYWORDS, NULL},
{"__replace__", _PyCFunction_CAST(namespace_replace), METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("__replace__($self, **changes)\n--\n\n"
"Return a copy of the namespace object with new values for the specified attributes.")},
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why this docstring uses the term attributes, but all the others in this PR use the term fields?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because SimpleNamespace is described as "a simple attribute-based namespace". code.replace() talk about fields (I copied the docstring for __replace__()). Also, the set of fields is limited for all other objects, you cannot set an arbitrary attribute.

@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) April 12, 2024 08:21
@serhiy-storchaka serhiy-storchaka merged commit 6e05537 into python:main Apr 12, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants