Hi I need to check if an object is in a list AND keep a reference to the object I have done it this way but is there a better one?
>>> def inplusplus(value,listObj): ... for i in listObj: ... if i is value: ... return value ... return False ... >>> l = [1,2,3,4] >>> print inplusplus(2,l) 2 >>> print inplusplus(9,l) False >>> print inplusplus(1,l) 1 >>> l.append(0) >>> print inplusplus(0,l) 0 -- http://mail.python.org/mailman/listinfo/python-list