[Python-Dev] Identifier API

Barry Warsaw barry at python.org
Thu Oct 13 15:42:24 CEST 2011


On Oct 13, 2011, at 03:23 PM, Antoine Pitrou wrote:

>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?

I agree that either is fine, with a slight preference for Py_IDENTIFIER for
the same reasons.

>> 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.

I'm fine with that too, as long as it's all well-documented in the C API
guide.

-Barry


More information about the Python-Dev mailing list