[Python-Dev] Why does _PyUnicode_FromId return a new reference? (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Sun Nov 6 17:40:25 CET 2011
- Previous message: [Python-Dev] Why does _PyUnicode_FromId return a new reference?
- Next message: [Python-Dev] None as slice params to list.index() and tuple.index()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Le 06/11/2011 08:08, "Martin v. Löwis" a écrit :
Am 05.11.2011 23:26, schrieb Antoine Pitrou:
Given it returns an eternal object, and it's almost always used temporarily (for attribute lookup, string joining, etc.), it would seem more practical for it to return a borrowed reference. For purity reasons: all PyUnicodeFrom* functions return new references (most of them return actually new objects most of the time); having PyUnicodeFromId return a borrowed reference would break uniformity. I personally it difficult to remember which functions return borrowed references, and wish there were fewer of them in the API
I agree with this general sentiment. For PyUnicode_FromId, though, I think it makes sense to return a borrowed reference.
Regards
Antoine.
- Previous message: [Python-Dev] Why does _PyUnicode_FromId return a new reference?
- Next message: [Python-Dev] None as slice params to list.index() and tuple.index()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]