`flush` keyword argument for `print()`?
CPython 3.3+ supports a flush keyword argument.
https://docs.python.org/3/library/functions.html#print
$ micropython
MicroPython 4fe0332-dirty on 2021-10-27; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> print(5, flush=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: extra keyword arguments given
Problem with kwargs
Consider this simple function:
def testfun(arg1=1,arg2=2):
print(arg1,arg2)
In micropython when I call it as testfun(arg2='two') I get the error TypeError: function missing required positional argument #-1 whereas in CPython3.3 it prints 1 two as expected.
In CPython3.3 if I do testfun(arg3='three') I get TypeError: testfun() got an unexpected keyword argument 'arg3' whereas micropython tells me TypeError: function does not take keyword arguments - right class, misleading message ;-)
def testfun2(arg1,arg2=2):
print(arg1,arg2)
CPy responds to a call of testfun2() with TypeError: testfun2() missing 1 required positional argument: 'arg1' whereas uPy says TypeError: function takes 2 positional arguments but 0 were given - again right class, (possibly) misleading message.
Let me know if you'd prefer me to break these out into separate issues rather than lumping them together.