[Python-checkins] r46671 - in python/trunk: Lib/bsddb/dbobj.py Lib/bsddb/test/test_all.py Lib/test/test_bsddb3.py Misc/NEWS Modules/_bsddb.c

Neal Norwitz nnorwitz at gmail.com
Tue Jun 6 22:39:33 CEST 2006


On 6/6/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
> Neal Norwitz wrote:
>
> > I fixed some parameter strings.  Is there any reason to not use
> > METH_NOARGS?  It would get rid of some checks that no args were
> > passed.
>
> the usual reason for not using METH_NOARGS is that the
> ParseTuple(":func") approach used to give more helpful
> error messages.  maybe that has been changed in more
> recent versions...  (no time to check, sorry).

I don't think that's the case any longer.  These msgs both look good
to me.  First is METH_O second is METH_NOARGS:

Python 2.4.1 (#1, Oct 25 2005, 14:38:12)
>>> [].count()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: count() takes exactly one argument (0 given)
>>> {}.keys(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: keys() takes no arguments (1 given)


More information about the Python-checkins mailing list