A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-November/114348.html below:

[Python-Dev] Why does _PyUnicode_FromId return a new reference?

[Python-Dev] Why does _PyUnicode_FromId return a new reference? [Python-Dev] Why does _PyUnicode_FromId return a new reference?"Martin v. Löwis" martin at v.loewis.de
Sun Nov 6 08:08:46 CET 2011
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 PyUnicode_From* functions return new references
(most of them return actually new objects most of the time); having
PyUnicode_FromId 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 (with
PyArg_ParseTuple being the notable exception where borrowed references
are a good idea).

Now, practicality beats purity, so the real answer is: I just didn't
consider that it might return a borrowed reference.

Regards,
Martin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4