When initializing an object, the error that is produced when the wrong number of positional arguments is given shows the wrong number of arguments given and required. It is off by +1. From my testing, this only happens when the object being initialized is a subclass.
Example:
import board
import neopixel # subclass of either _pixelbuf or pypixelbuf, depending on CP version and/or board
extra_arg = None
pixels = neopixel.NeoPixel(board.D5, 24, extra_arg) # This is supposed to have only 2 positional arguments here
Output:
TypeError: function takes 4 positional arguments but 5 were given
Expected Output:
TypeError: function takes 3 positional arguments but 4 were given
I tested this on an itsybitsy_m4_express running CP 5.3.0 and 5.4.0-beta.1
When initializing an object, the error that is produced when the wrong number of positional arguments is given shows the wrong number of arguments given and required. It is off by +1. From my testing, this only happens when the object being initialized is a subclass.
Example:
Output:
Expected Output:
I tested this on an itsybitsy_m4_express running CP 5.3.0 and 5.4.0-beta.1