Author blais
Recipients asvetlov, blais, docs@python, martin.panter
Date 2015-05-25.12:32:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1432557130.2.0.785067063599.issue24278@psf.upfronthosting.co.za>
In-reply-to
Content
Adding information that tells developers where the memory for those returned areas is stored and as you mention, its lifetime guarantees w.r.t. to the Python object, would go a long way towards making this more clear. The questions that immediately came to my mind were:

- Is this memory attached to the object?

- What if there is a conversion... is it still attached to the object? The converter for "s" says "Unicode objects are converted to C strings using 'utf-8' encoding."  Where is the output of this conversion stored? Does it have the same lifetime as its PyObject as well or does it use a cache of recent conversions (e.g. like re/struct), or just static storage? And if so, is it thread-safe?

I can find all these answers by looking at the source code for C/Python, or I can _guess_ that extra data is attached to some sort of 'extra' field in a PyObject (which would be a sensible thing to do), but my point is that an API user shouldn't have to dig in the source or have to guess for such important concerns. I think we should be a bit more transparent in the docs.
History
Date User Action Args
2015-05-25 12:32:10blaissetrecipients: + blais, asvetlov, docs@python, martin.panter
2015-05-25 12:32:10blaissetmessageid: <1432557130.2.0.785067063599.issue24278@psf.upfronthosting.co.za>
2015-05-25 12:32:10blaislinkissue24278 messages
2015-05-25 12:32:09blaiscreate