Craig> IMO the reference behaviour of functions in the C API could be
    Craig> clearer. One often has to simply know, or refer to the docs, to
    Craig> tell whether a particular call steals a reference or is reference
    Craig> neutral.  Take, for example, PyDict_SetItemString vs
    Craig> PyMapping_SetItemString . Is it obvious that one of those steals
    Craig> a reference, and one is reference neutral? Is there any obvious
    Craig> rationale behind this? 

Sure.  PyDict_SetItemString was first written very early on in Python's
development (actually, it was originally called something
namespace-ly-dangerous like dict_setstring).  PyMapping_SetItemString (part
of the abstract objects api) was written later with an emphasis on the
consistency of behavior you desire.  You're generally going to be better off
sticking with the abstract objects api.  For obvious reasons of backward
compatibility, the concrete apis (PyDict_*, PyList_*, etc) must be retained.

Skip
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to