Please explain the meaning of 'stealing' a ref

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Tue Nov 4 08:38:07 EST 2003


On Tue, 4 Nov 2003 12:32:22 GMT, rumours say that Michael Hudson
<mwh at python.net> might have written:

>Christos "TZOTZIOY" Georgiou <tzot at sil-tec.gr> writes:
>
[my attempting to implement attribute caching]
>
>Are you aware of the cache-attr-branch (think it's called that) in
>CVS?

<sigh> Obviously, not :(

[my question about what "stealing means"]
>
>This *really* should be explain in the API reference or the extended
>and embedding manual somewhere... have you looked there?

Oh, definitely, ext/refcountsInPython.html is the page I believe.  I can
understand the second paragraph, but I wanted some reasoning.  For
example, you call a function that its API specifies that it "steals" a
reference to its argument; therefore, you got to incref in advance and
decref afterwards yourself.  What's the reason?  Efficiency for
simplicity of the function?  If yes, why not enclose the function call
in a incref / decref cycle and then export the enclosing function in the
API?

Such stuff I wanted to know.

Also, "borrowing" and "stealing" are the same thing?  I just think that
"beautifying" terminology at the C level is more confusing than helpful.

PS Thanks KefX and Edward for your replies.  I'll check the branch.
-- 
TZOTZIOY, I speak England very best,
Ils sont fous ces Redmontains! --Harddix




More information about the Python-list mailing list