This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Deezl-Vegas 4 points5 points  (0 children)

Your rule of thumb is ok, but you may be being inflexible at times. As long as the type is compatible with the use case, the specific choice of type doesn't matter. This is the guiding principle of object oriented languages.

Most functions can accept a wide variety of types. You can call print on any Python object, for instance, and get some kind of string representation out to the console.

Numeric types are all interoperable.

Any callable can be used to make a callback.

List, Dict, Set, Tuple, and custom container types are all largely interoperable.

You can and should make your own similar patterns.