-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
bpo-35105: Document that CPython accepts "invalid" identifiers #11263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1388,6 +1388,17 @@ are always available. They are listed here in alphabetical order. | |||||||||
object allows it. For example, ``setattr(x, 'foobar', 123)`` is equivalent to | ||||||||||
``x.foobar = 123``. | ||||||||||
|
||||||||||
.. note:: | ||||||||||
|
||||||||||
setattr() attempts to update the object with the given attr/value pair. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (in addition to the above)
Suggested change
or
Suggested change
|
||||||||||
Whether this succeeds and the effect it has determined by the target object. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
If an object's class defines `__slots__`, the attribute may not be writeable. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
If an object's class defines :class:`property` with a setter method, the *setattr()* | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||
will trigger the setter method which may or may not actually write the attribute. | ||||||||||
For objects that have a regular dictionary (which is the typical case), the | ||||||||||
*setattr()* call can make any string keyed update allowed by the dictionary | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
including keys that aren't valid identifiers -- for example ``setattr(a, '1', 'one')`` | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you happen to have an example of this behavior? I'm not quite following what it's doing (how |
||||||||||
will be the equivalent of ``vars()['1'] ='one'``. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
.. class:: slice(stop) | ||||||||||
slice(start, stop[, step]) | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.