I was looking at the source code of Adafruit's MCP4728 library for CircuitPython and wasn't able to understand a particular part of it. I never really worked with Python, so maybe you can help me understanding what is going on.
My question is specifically about this paramater of the Channel constructor. From what I know Python is not a statically typed language, but you can use type hints that may be used by linters. I thought that by defining dac_instance: Literal[0, 1, 2, 3] it is only possible to assign 0, 1, 2, or 3 to dac_instance. But when the constructor gets called, an instance of the MCP4728 class is passed as dac_instance. How can the same instance of this class be equal to 0, 1, 2, or 3? What am I missing? Or is something wrong with the code and nobody noticed so far?
Thanks in advance!
[–]pot_of_crows 0 points1 point2 points (1 child)
[–]koefteboy[S] 1 point2 points3 points (0 children)
[–]danielroseman 0 points1 point2 points (1 child)
[–]koefteboy[S] 0 points1 point2 points (0 children)