You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keyword-only arguments work fine in nopython mode:
In [1]: from numba import njit
In [2]: def f(a, *, b):
...: return a * b
...:
In [3]: f(1, b=2)
Out[3]: 2
In [4]: f(1, 2)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-c9c271413adf> in <module>
----> 1 f(1, 2)
TypeError: f() takes 1 positional argument but 2 were given
In [5]: nf = njit(f)
In [6]: nf(1, b=2)
Out[6]: 2
However, I expected nf(1, 2) to fail in the same way as f(1, 2), but it doesn't:
I think feature request, Numba's only just got out of having to support both Python 2 and 3. IIRC this is a Python 3 only feature and, as signature handling is very hard, it wasn't of a particularly high priority to handle version specific features when supporting both major versions of Python.
Reporting a bug
the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
to write one see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports).
Keyword-only arguments work fine in nopython mode:
However, I expected
nf(1, 2)
to fail in the same way asf(1, 2)
, but it doesn't:(perhaps related to #2994?)
The text was updated successfully, but these errors were encountered: