4 ms·
> In a fully dynamically-typed language, there's no real downside for heavily polymorphic APIs and a lot of upside in terms of brevity and flexibility. Wow, I'
by duaneb 11y ago
> In a fully dynamically-typed language, there's no real downside for heavily polymorphic APIs and a lot of upside in terms of brevity and flexibility.
Wow, I'd say that's a major pain point for me—reasoning about polymorphic code with only vague guidelines:
"give me something that looks like a string".
"Well, which types are those?"
"Hell if I know! But it needs these methods, but it can also change its behavior if it doesn't have them"
"stabs self in neck because this was solved in the 60s"
Seeing a hard-to-skim polymorphic API for anything but a quick script is a massive problem for me—the time sink in just parsing its behavior isn't worth the inevitable problems that come with the edge cases at runtime.
That said, requests is great and I use it to do all my web scraping because it's super idiomatic. I had no idea the interface was that complicated, though, and it reduces my confidence in the library.
This PEP reminds me of typed racket: pretty awesome, but a completely separate language to write with separate considerations.