3 ms·
You can write it for ints, figure out it's also useful for strings, and change the signature to also accept str. And then if you do ever want to change the impl
by duckerude 6y ago
You can write it for ints, figure out it's also useful for strings, and change the signature to also accept str. And then if you do ever want to change the implementation you can reason about the callers more easily and you won't have to create a new variant function for fear of breaking them.
But perhaps that only makes sense for some functions. Probably not twice().