-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
Milestone
Description
In the pybind11 detail
code, we have 3 different kinds of type information:
- C++ RTTI:
std::type_info
- Python's
PyTypeObject
- pybind11's extended type information:
detail::type_info
The variable naming scheme for these 3 kinds of type info objects isn't currently very consistent. type
, tinfo
, type_info
, etc. are used interchangeably for all 3 kinds of type info, which can cause confusion (at least it does for me). And as I've recently found in #1014, it can result in some unfortunate expressions like x.type->type
(where the second type isn't a Python-style metatype, it's just a different kind of type object).
I'd like to propose a naming convention for these objects (especially when they are members):
std::type_info
: variables namedcpptype
(already in use, but only partially).PyTypeObject
:pytype
.detail::type_info
: it would be nice to rename the type todetail::extended_type
(to avoid confusion withstd::type_info
) and name variables likeext_type
oret
.
What do you think? Does it make sense or am I just bikeshedding?