Message320485
When I call a function decorated with functools.singledispatch without an argument, I get the following:
$ python
Python 3.6.5 (default, Jun 17 2018, 12:13:06)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import functools
>>> @functools.singledispatch
... def f(x):
... pass
...
>>> f()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/functools.py", line 803, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
IndexError: tuple index out of range
I would have expected a TypeError along the lines of
TypeError: f() missing 1 required positional argument: 'x' |
|
Date |
User |
Action |
Args |
2018-06-26 11:57:10 | doerwalter | set | recipients:
+ doerwalter |
2018-06-26 11:57:10 | doerwalter | set | messageid: <1530014230.86.0.56676864532.issue33967@psf.upfronthosting.co.za> |
2018-06-26 11:57:10 | doerwalter | link | issue33967 messages |
2018-06-26 11:57:10 | doerwalter | create | |
|