Reference behavior through C (was: Lambda going out of fashion)

Cameron Laird claird at
Tue Dec 28 19:08:15 CET 2004

In article <mailman.8308.1103787075.5135.python-list at>,
Craig Ringer  <craig at> wrote:
>  IMO the reference behaviour of functions in the C API could be
>clearer. One often has to simply know, or refer to the docs, to tell
>whether a particular call steals a reference or is reference neutral.
>Take, for example, PyDict_SetItemString vs PyMapping_SetItemString . Is
>it obvious that one of those steals a reference, and one is reference
>neutral? Is there any obvious rationale behind this? I'm not overflowing
>with useful suggestions about this, but I do think it'd be nice if there
>was a way to more easily tell how functions behave in regard to
>reference counts.
This is a sensitive area for me, too.  I'd welcome insight
on how to think about this.  If Pythonia were a better place
in this regard, how would it be?  Reference documents that
more transparently define reference behavior?  A convention 
for API names that reveals reference characteristics?  Is 
there someone who's confident with Python use through C that
has a reliable process for getting reference counts right?

More information about the Python-list mailing list