3 ms·
> What's a situation where you would want to take a collection of objects that don't even share a common interface? I found myself in a situation exactly like
by Mister_Snuggles 9y ago
> What's a situation where you would want to take a collection of objects that don't even share a common interface?
I found myself in a situation exactly like this a while back.
I was given the job of figuring out how to validate data in various stages of an ETL pipeline. I ended up writing a Python program to do the work in a fairly configurable manner.
The key to this working was the fact that tuples in Python can be used as keys for a hash table and are comparable. The program would run different queries in different databases, split the results out into key and value tuples, use the key to store the value tuples in a hash table, and finally do some comparisons.
Since it was all driven by configuration, the code that did the comparison across couldn't know in advance what the data types were or how many columns were involved.