I saw some there are some typedef in CPython as shown below, what does ty mean in the type name? A short form of type?
typedef struct _mod *mod_ty;
typedef struct _stmt *stmt_ty;
typedef struct _expr *expr_ty;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Given that it’s a
typedefand the new type is simply the structure name with_tyappended, I think you’ve hit the nail on the head.It’s just a short form of
typeso that you can instantly tell that a variable of typexyzzy_tyis simply a pointer to a variable of typestruct _xyyzy.The rules you follow for this sort of thing aren’t set in stone but it’s useful to be consistent.
PEP7 is the style guideline for CPython C source code, similar to PEP8 for the Python source code.