What magic method do I have to modify to support the in
operator. Here's an example of what I'm trying to do:
class DailyPriceObj:
def __init__(self, date, product_id=None):
self.date = date
self.product_id = product_id
self.sd_buy = None
l = list()
l.append(DailyPriceObj(date="2014-01-01"))
DailyPriceObj(date="2014-01-01") in l # how to get this to return True?
In other words, I want my object to "act like" the date
property, so I can use that to see if that obj
is in an interable (date
should be a unique field here).