4 ms·
>How do other Python projects avoid this? https://github.com/jonathanslenders/pymux/blob/master/pymux/process.py#L54 https://github.com/jonathanslenders/pymux/
by crdoconnor 9y ago
>How do other Python projects avoid this?
https://github.com/jonathanslenders/pymux/blob/master/pymux/process.py#L54 https://github.com/jonathanslenders/pymux/blob/master/pymux/...
Here's one way. Those asserts will typically pick up on errors during spikes, development and tests and turn a head scratching problem into a straightforward issue.
A couple of times on a disastrously tech debt ridden project I used it to pick up obscure configuration errors in prod, too (shouldn't see it in prod on a relatively well written project tho).
- andybak 9y agoYou might consider this too much of an edge case but what if I want to pass something that quacks like an EventLoop to Process init ?
- crdoconnor 9y agoUnless it's a subclass (which would pass), I don't imagine that would be at all likely. Never been much of a fan of duck typing. It only really makes sense when you have objects that approximate built in types. Take a random object with a .run() method, for example, and you don't have a fucking clue what it might be doing so there's no point interpreting that as a quack.