[Python-Dev] Identifier API

Antoine Pitrou solipsis at pitrou.net
Thu Oct 13 15:23:23 CEST 2011


On Thu, 13 Oct 2011 14:00:38 +0200
"Martin v. Löwis" <martin at v.loewis.de> wrote:
> > I like this better too because of the all-caps macro name.  Something about
> > seeing "Py_identifier" look like a function call and having it add the magical
> > PyId_update local bugs me.  It just looks wrong, whereas the all-caps is more
> > of a cultural clue that something else is going on.
> 
> If people think the macro should be all upper-case, I can go through and 
> replace them (but only once). Let me know what the exact spelling
> should be.

Py_CONST_STRING or Py_IDENTIFIER would be fine with me.
Given that everything else uses "Id" in their name, Py_IDENTIFIER is
probably better?

> Originally, I meant to make the variable name equal the string (e.g.
> then having a variable named __init__ point to the "__init__" string).
> However, I quickly gave up on that idea, since the strings conflict
> too often with other identifiers in C. In particular, you couldn't
> use that approach for calling the "fileno", "read" or "write" methods.
> 
> So I think it needs a prefix. If you don't like PyId_, let me know
> what the prefix should be instead.

I agree with that.

Regards

Antoine.




More information about the Python-Dev mailing list