QUERY · ISSUE
Empty op name printed when missing from mp_binary_op_method_name
py-core
With MICROPY_PY_ALL_SPECIAL_METHODS =0,
>>> 1 + 1
2
>>> 1 + 1 / 1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported types for : 'int', 'int'
>>>
You can see the print is a bit broken and it makes you question whether something deeper has gone wrong. I think it would be better to print something, like "unknown" or "unknown op".
For example, [0 ... MP_BINARY_OP_NUM_RUNTIME-1] = MP_QSTR_unknown, as the first line of mp_binary_op_method_name does the trick. It basically adds just this single "unknown" qstr.
CANDIDATE · ISSUE
print(a=2) does not throw invalid keyword error
In fact there is no error at all. Unrecognized keywords are ignored.
On normal python the response is:
>>> print(a=2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'a' is an invalid keyword argument for this function
>>>
I found this one when I was teaching a non-programmer the difference between conditional == and assignment = and had not even got to the bit about functions and keyword arguments.