Larry Hastings added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20189>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to