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-October/113980.html below:

[Python-Dev] Identifier API

[Python-Dev] Identifier APIAntoine Pitrou solipsis at pitrou.net
Sat Oct 8 17:43:33 CEST 2011
On Sat, 08 Oct 2011 16:54:06 +0200
"Martin v. Löwis" <martin at v.loewis.de> wrote:
> 
> I find the ad-hoc approach of declaring and initializing variables
> inadequate, in particular since it is difficult to clean up all
> those string objects at interpreter shutdown.
> 
> I propose to add an explicit API to deal with such identifiers.

That sounds like a good idea.

> With this API,
> 
>      tmp = PyObject_CallMethod(result, "update", "O", other);
> 
> would be replaced with
> 
>       PyObject *tmp;
>       Py_identifier(update);
>       ...
>       tmp = PyObject_CallMethodId(result, &PyId_update, "O", other);

Surely there is something missing to initialize the "const char *" in
the structure? Or is "Py_identifier()" actually a macro?

> string will be initialized by the compiler, next and object on
> first use. The new API for that will be
> 
> PyObject* PyUnicode_FromId(Py_Identifier*);
> PyObject* PyObject_CallMethodId(PyObject*, Py_Identifier*, char*, ...);
> PyObject* PyObject_GetAttrId(PyObject*, Py_Identifier*);
> int PyObject_SetAttrId(PyObject*, Py_Identifier*, PyObject*);
> int PyObject_HasAttrId(PyObject*, Py_Identifier*);

Do we want to make these APIs public?

Regards

Antoine.


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