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.

classification
Title: Incorrect documentation for InPlace Number operators
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: agthorr, rhettinger
Priority: normal Keywords:

Created on 2005-06-15 19:46 by agthorr, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg25555 - (view) Author: Daniel Stutzbach (agthorr) Date: 2005-06-15 19:46
The documentation for the various InPlace abstract
number operators (PyNumber_InPlaceSubtract, etc.)
specify that the functions return a new reference. 
Unless I'm mistaken, this is incorrect.  The functions
do not increment increment the reference counter.  

msg25556 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-06-15 21:15
Logged In: YES 
user_id=80475

Actually, they do.  Arithmetic operations create new number
objects.
msg25557 - (view) Author: Daniel Stutzbach (agthorr) Date: 2005-06-15 21:29
Logged In: YES 
user_id=6324

How are the InPlace versions different from the regular
versions, then?

I do remember something about number objects in Python being
immutable, so what you say makes sense.  I'm just not sure
if I need to be decrementing any reference counters when I'm
trying to do the equivalent of "a += b".

Perhaps adding some text to the top of that section
describing what "in-place" means in this context?
History
Date User Action Args
2022-04-11 14:56:11adminsetgithub: 42088
2005-06-15 19:46:46agthorrcreate