4 ms·
But you still have an explicit interface.
by MatthewPhillips 14y ago
But you still have an explicit interface.
- _ak 14y agoBut an implicit implementation of that interface.
- NateDad 14y agoThe interface just defines the methods an object must have to be passed into this function. No types have to "implement" the interface in the traditional sense. Anything that happens to have the same methods as are on the interface may be passed into the method that requires that interface. Basically, the interface just defines at compile time what Python defines at runtime... except it's a hell of a lot easier to see what methods are required for a Go interface, than it is to see what methods are required for a python function (you basically have to read the entire function and any function that function passes the argument to). Not that I don't like python, I do.
- knome 14y agoThe metaphor has an explicit duck.