[Python-Dev] Borrowed and Stolen References in API

Greg Ewing greg.ewing at canterbury.ac.nz
Tue May 10 02:13:47 CEST 2011

Nick Coghlan wrote:

> One interesting aspect is that from the caller's point of view, a
> *new* reference to the relevant behaves like a borrowed reference for
> input parameters, but like a stolen reference for output parameters
> and return values.

I think it's less confusing to use the term "new" only for
output/return values, and "stolen" only for input values.

Inputs are either "borrowed" or "stolen" (by the callee).

Outputs are either "new" (to the caller) or "borrowed"
(by the caller).

(Or maybe the terms for outputs should be "given" and "lent"?-)


More information about the Python-Dev mailing list