I know this isn’t quite what you asked, but here is a story that captures for me the problem in OO that multiple dispatch resolves.
Pandas as a number of df.to_<file format>(path)
methods. If you pass a string, it treats it like a path and tries to write to it. If you have an s3 package loaded, you can pass it a string URI to a s3 bucket, and it will write to the bucket with no other configuration. Very cool.
There is a package called S3Path which aims to extend the pathlib API to URIs. But you can’t pass an S3Path object to a df.to_<file format>(path)
method because Pandas doesn’t call the correct open
method on the file object. There is an open issue in the S3Path github page where they lament Pandas’ poor choice.
But of course, if this were Julia, they would just define write(::S3Path, ::DataFrame)
and be done with it because you can dispatch a new method on … multiple arguments.
This kind of thing happens all the time. The nature of an interaction between two or more things is contigent upon the nature of all of the objects, not just the first.