Closed tekktrik closed 2 years ago
If this isn't widely used enough, I could also just type it in the relevant library
If this isn't widely used enough, I could also just type it in the relevant library
If it's used in more than one library, it's good to have it in a central place. Otherwise you can put the definitions inside the try
block for the typing imports. They will take space in a library, which is one reason not to include them in libraries.
If they get caught (or missed, really) because of the try
/except
block, that should prevent them from using memory though, right? Either way, I'll try to raise it on a case-by-case basis then
Right, it's static code size, either in the filesystem, or in a frozen module.
Converted to draft for now. There may be other uses of this in the libraries but I'm not sure... I'll take a look and see if it's worth putting here or not!
Okay, I found at least a few libraries that use Protocol
for LEDs in their library. Basing those types here seems to be a good idea in this case.
Looks like you'd need to define __getitem__
and/or __setitem__
in the protocol so yup!
@FoamyGuy do you know of any libraries that would need that set in the Protocol? I don't necessarily want to over constrain the protocols if where they are doesn't require that specific behavior (ex: the only need to generically describe fill()
/color()
.)
Sounds good!
Useful for typing LEDs without having to import them. Spawned from typing
adafruit_esp32spi
.