I have an example class:
class Example():
def __init__(self, id, code, table):
self.id = id
self.code = code
self.table = table
and three objects
a = Example(1,10,100)
b = Example(2,10,200)
c = Example(3,20,100)
What I would like to achieve is something like this:
s = [a,b,c]
x = sql(code = 10, s) #x = (a,b)
x = sql(id = 3, s) #x = (c,)
x = sql(table > 200, s) #x = ()
I don't want to perform very complex queries but a suggestion of any approach is valuable as long as it is fast (That's why I don't use a filter function) and also avoids setting up an external database.