4 ms·
I think you typed "python" wrong :) Duck typing is a python thing. And the dependency management is a nightmare, constantly breaking. To the article's point - y
by sethammons 3y ago
I think you typed "python" wrong :)
Duck typing is a python thing. And the dependency management is a nightmare, constantly breaking. To the article's point - you _must_ run it in a container and defer to the OS to have anything resembling a sane development story.
- throwawa14223 3y agoOk that's totally fair. What's the Go name for it? In my mind Go interfaces are duck typed.
- sethammons 3y agomostly joking - your complaints are big problems in python. Dependency management in Go has been contentious (historically) with "to vendor or not to vendor", glide and dep, GOPATH, etc. But that is all solved. Go mod for the win. As far as "the nightmare of {using interfaces}" -- I have no clue to any controversy there. It is one of the most celebrated features of Go. Not sure where you were going with that. In Python, I do find duck typing to be a nightmare because you don't actually _know_ what you have. Can you change it? Try it and if it breaks you will know. Or you use it like a list but it is a string and that gives strange, unexpected behavior, so you end up doing things like `param=force_list(maybe_string_or_list)`.
- pydry 3y agoThe Python typing nightmares you refer to go away on large projects as soon as you start using mypy, which I tend to find most large projects do these days. So yes, you can change that string and you do know. It's still better that it's optional and gradual - it's unnecessary overhead on smaller projects, spikes, notebooks, etc. which are what most big projects grow out of.
- kietay 3y agoPython typing nightmares definitely do not just go away with the use of mypy. There are so so many ways to break out of the guardrails it supplies that are not caught.
- pydry 3y agoI can write stringly typed code in haskell too if it comes to that.
- Biganon 3y agoDon't you need stumps which are quite often not available?
- lokar 3y agoWhat were they actually doing? Passing interface{} all the time and casting it?
- throwawa14223 3y agoHaha you're spot on. In the codebase I inherited that was everywhere.
- mathisd 3y agoPython is duck typed as it support dynamic type, whereas Go doesn't. Yet you can do polymorphism in Go and aside that difference I think Go interface are duck typed.
- theLiminator 3y agoProbably structural typing?
- sroussey 3y agoI think you typed “JavaScript” wrong… ;)
- pjmlp 3y agoOP meant structured typing, which is the strong type version of duck typing. As long as the type supports the same interface anything goes, even it actually supports another one, where the methods have the same name, with different semantics.