In the documentation for the I2C constructors I find a statement such as:
classmachine.I2C(id=- 1, *, scl, sda, freq=400000)
What does the asterisk mean? I couldn't find an explanation and the documentation does not include one. All other information in this statement makes sense.
Thanks --Jon
What the heck does I2C constructor asterisk mean?
Re: What the heck does I2C constructor asterisk mean?
I think it's something like that the parameters before the asterisk are mandatory, the ones after are optional and will have defaults.
There is probably a more formal explanation.
There is probably a more formal explanation.
Re: What the heck does I2C constructor asterisk mean?
It's a python thing and not specific to MicroPython.
The formal definition can be found here: https://docs.python.org/3/reference/com ... efinitions
This is from the paragraph that starts "Function call semantics ..."
The formal definition can be found here: https://docs.python.org/3/reference/com ... efinitions
This is from the paragraph that starts "Function call semantics ..."
Parameters after “*” or “*identifier” are keyword-only parameters and may only be passed by keyword arguments.
Re: What the heck does I2C constructor asterisk mean?
Thank you for the information, which I appreciate greatly. You have all saved me a lot of time! --Jon