3 ms·
I am not elbow deep into Python ecosystem, but how many python code bases are fully type-hinted? Maybe I am overlooking because I am not a pythonista, but when
by exceptione 2y ago
I am not elbow deep into Python ecosystem, but how many python code bases are fully type-hinted?
Maybe I am overlooking because I am not a pythonista, but when looking at this code [1] I see only some superficial hints. Looking at `_make_command`, I need to look inside the body to see that the first argument is expected (?) to be callable (it just ignores otherwise).
____
1. https://github.com/pyinfra-dev/pyinfra/blob/3.x/pyinfra/api/facts.py https://github.com/pyinfra-dev/pyinfra/blob/3.x/pyinfra/api/...
- belthesar 2y agoIt's definitely still in the minority, but you're seeing a _lot_ more newer projects adopting consistent, ubiquitous type hints. To your point though, the `_make_command` method here is not setting hints in its arguments. I'm not super familiar if this is considered "fine" in a pydantic world, as I found for my usage, native python type hints were more than fine to make my code more usable and safer. Based on the code though, it seems like there are cases where the `command_attribute` is not a callable. What I don't understand is why this isn't hinted as a Union of Callable and whatever other types it could receive. I'd have to spend more than 3 minutes looking at the code base to understand how it's used to get a stronger idea here.