➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 larry
收信人 barry, brett.cannon, gvanrossum, larry, meador.inge, ncoghlan, skrah, tim.peters, yselivanov, zach.ware
日期 2014-01-24.03:56:17
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1390535778.41.0.852746525675.issue20189@psf.upfronthosting.co.za>
In-reply-to
内容
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.
历史
日期 用户 动作 参数
2014-01-24 03:56:18larry修改recipients: + larry, gvanrossum, tim.peters, barry, brett.cannon, ncoghlan, skrah, meador.inge, zach.ware, yselivanov
2014-01-24 03:56:18larry修改messageid: <1390535778.41.0.852746525675.issue20189@psf.upfronthosting.co.za>
2014-01-24 03:56:18larry链接issue20189 messages
2014-01-24 03:56:17larry创建