Message209032
A little more on consistency and inconsistency.
I count 109 tp_new callback functions in CPython, and they overwhelmingly call the first parameter "PyTypeObject *type" (93 instances). In second place is "PyObject *self" (9 instances), which is flat-out wrong.
I count 21 METH_CLASS callback functions in CPython; they prefer calling the first parameter "PyObject *cls" (16 instances). In second place is "PyTypeObject *type" (3 instances).
Both callbacks are class methods. And both callbacks are passed the *exact same object* for their first parameter, the PyTypeObject * representing that type.
I can see no good reason why they should have different names in different callbacks. There's no practical or semantic difference between the two. I suspect it's something silly like legacy code / copying and pasting / force of habit, perhaps carried over from the days before type/class unification. |
|
Date |
User |
Action |
Args |
2014-01-24 03:56:18 | larry | set | recipients:
+ larry, gvanrossum, tim.peters, barry, brett.cannon, ncoghlan, skrah, meador.inge, zach.ware, yselivanov |
2014-01-24 03:56:18 | larry | set | messageid: <1390535778.41.0.852746525675.issue20189@psf.upfronthosting.co.za> |
2014-01-24 03:56:18 | larry | link | issue20189 messages |
2014-01-24 03:56:17 | larry | create | |
|