[Python-Dev] PEP 509

Victor Stinner victor.stinner at gmail.com
Tue Jan 12 18:24:32 EST 2016


2016-01-12 23:24 GMT+01:00 Ethan Furman <ethan at stoneleaf.us>:
> Even if not exposed at the Python layer, it's still exposed when working at
> the C layer.  Is __version__ any less confusing there?  (I only work in C
> when working on Python, and only occasionally, so my question is real.)

Fields of the PyDictObject must be prefixed with "ma_". If you read
the prior art of the PEP, you will see that Antoine Pitrou also
proposed the "ma_version" name. The existing version on types used the
"version_tag" name. Maybe I should pick this one.

Dunder names like __version__ is not used in the C language.

Do you expect "__version__" to be somehow "protected" or "private"?
The field is definitely public in the Python C API, and I don't think
that it's a problem. It's not really a choice, there is no way to hide
a field of a C structure. If you start to do random things on the C
API, it's your responsability :-)

Victor


More information about the Python-Dev mailing list