astrofrog astrofrog - 1 year ago 132
Python Question

Override 'in' operator?

If I am creating my own class in Python, what function should I define so as to allow the use of the 'in' operator, e.g.

class MyClass(object):

m = MyClass()

if 54 in m:

Answer Source
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download