2 ms·
Which is a great approach if you're slinging JSON between different languages and implementations. Python is fine with duck typing.
by DonHopkins 9y ago
Which is a great approach if you're slinging JSON between different languages and implementations.
Python is fine with duck typing.
- logicchains 9y agoIt's also really good for testing: if you want to mock some opaque third-party object, you can just create an interface with the same methods as that object and use it in your code. Nominal types often don't allow this, such as how in Java you can't make a class to which you don't have the source implement your own interface, or make it painful, like orphan instance restrictions in Rust and Haskell.