-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Naming #21
Comments
I'd also say: After API is removed, the name should not be reused. Old docs live forever 📚 |
To be clear: I think this should include configure macros like |
Currently there are 77 names with the I think that the |
Using |
I propose to legalize the use of Unfortunately, there is a number of |
The Naming conventions section of PEP 7 says Macros should have a MixedCase prefix, right after defining what “prefix” is. IMO, it's very clear that you should use It's of course possible to break that rule to be consistent with surrounding code that also breaks it, and we can of course change existing guidelines.
Oh, we'd promise that the macro can be used in Unfortunately, we have some |
I opened a wider discussion: https://discuss.python.org/t/py-prefix-for-if-friendly-macros/60825 |
Most of this is already in PEP-7. IMO we should move guidelines with user-visible effects out of the style guide.
For new API, all public names must be prefixed with
Py
.Names that users should not use directly, but should be visible to the compiler/linker, should be prefixed with
_Py
.This applies to all names in a global namespace: functions, macros, variables, typedefs, structs, enums, etc.; not to parameters or struct fields.
(XXX: In C, “all identifiers that begin [...] with an underscore (_) followed by an uppercase letter are reserved for any use”. Using the
_Py
prefix has undefined behavior.)The
Py_
prefix is reserved for global service routines likePy_FatalError
; specific groups of APIs use a longer prefix, e.g.PyString_
for string functions.The prefix is in mixed case, even in macro names (e.g.
PyString_AS_STRING
).Unstable API is prefixed with
PyUnstable_
instead ofPy
, e.g.PyUnstable_Long_IsCompact
or *PyUnstable_String_GET_SIZE
.The text was updated successfully, but these errors were encountered: