Message270650
It looks to me that the repr of a collection contains a dynamic name if it is implemented in Python and hardcoded base name if it is implemented in C (OrderedDict originally was implemented in Python). Maybe just because tp_name contains full qualified name, and extracting a bare class name needs few lines of code.
There is similar issue with the io module classes: issue21861.
Since this problem is already solved for OrderedDict, I think it is easy to use this solution in other classes. Maybe factoring out the following code into helper function.
const char *classname;
classname = strrchr(Py_TYPE(self)->tp_name, '.');
if (classname == NULL)
classname = Py_TYPE(self)->tp_name;
else
classname++; |
|
Date |
User |
Action |
Args |
2016-07-17 16:20:15 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, r.david.murray, xiang.zhang |
2016-07-17 16:20:14 | serhiy.storchaka | set | messageid: <1468772414.99.0.0513025761293.issue27541@psf.upfronthosting.co.za> |
2016-07-17 16:20:14 | serhiy.storchaka | link | issue27541 messages |
2016-07-17 16:20:14 | serhiy.storchaka | create | |
|