Using variable number of keyword arguments #10236
-
I am running the code below from Thonny editor
I am getting the following error (running 1.19.1 on Pico): It works as expected...
... until I add a keyword argument.
It works fine if I use the Pin class:
What am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
This is an interesting limitation specifically to do with how super() interacts with Basically in the way builtin kwarg-capable functions work generally is different to I can't think of a good workaround, but might just be better to implement the fix. |
Beta Was this translation helpful? Give feedback.
-
As a general point, subclassing of built-in types is not supported. See this doc. Usually you can work round this by using composition rather than inheritance. |
Beta Was this translation helpful? Give feedback.
-
This is now implemented |
Beta Was this translation helpful? Give feedback.
This is an interesting limitation specifically to do with how super() interacts with
__init__
of built-in types (which is calledmake_new
in the C code).Basically in the way builtin kwarg-capable functions work generally is different to
make_new
(for efficiency reasons), so there needs to be extra mapping (which isn't currently implemented).I can't think of a good workaround, but might just be better to implement the fix.