[Python-Dev] New poll about a macro for safe reference replacing

Serhiy Storchaka storchaka at gmail.com
Mon Dec 21 08:46:00 EST 2015


On 16.12.15 16:12, Serhiy Storchaka wrote:
> Please put your vote (a floating number from -1 to 1 including) for
> every of proposed name. You also can propose new name.

Thank you all for your votes.

Results of the poll:

Py_SETREF:  +5 = +5 (Victor, Steve, Yury, Brett, Nick) +0 (Ryan, Martin)

Py_REPLACE_REF:  +2.5 = +2.5 (Ryan, Victor, Steve, Martin) -0 (Nick)

Py_REPLACE: +0 = +1 (Martin) -1 (Ryan) +0 (Nick)

Py_RESET:  0 = +1 (Ryan) -1 (Martin)

Py_DECREF_REPLACE: -2 = +1 (Ryan, Martin) -3 (Victor, Steve, Nick)

Py_SET_POINTER, Py_SET_ATTR: -5 (Ryan, Victor, Steve, Martin, Nick)

Therefore Py_SETREF is the winner.

But I want also to remember objections against it formulated in previous 
discussion.

1) By analogy with Py_INCREF and Py_DECREF that increment and decrement 
the reference counter of the object, Py_SETREF looks as it *sets* the 
reference counter of the object.

2) By analogy with PyList_SET_ITEM, PyTuple_SET_ITEM, PyCell_SET, etc, 
it is not expected that Py_SETREF decrement the refcounter of the old 
value before overwriting it.




More information about the Python-Dev mailing list