[Python-3000] Type repr (original) (raw)

Armin Ronacher armin.ronacher at active-4.com
Sun Mar 18 20:45:50 CET 2007


Hoi,

Some time I proposed changing the type repr to the import name. While I still think this is a good idea ;-) I found a small inconsistency in the repr code of PyTypeObject. Currently the repr checks for the Py_TPFLAGS_HEAPTYPE flag to check if it should use "class" or "type" as name for the repr.

Now where types and classes are the same i don't think it's a good idea to have different reprs for objects defined in python and for objects defined in the C API.

My proposal: change the repr for all objects to "class". So <class 'int'>, <class 'UserDefinedClass'> etc.

Regards, Armin



More information about the Python-3000 mailing list