In <[EMAIL PROTECTED]>, Jorge Vargas
wrote:

> 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?

But you already *have* a reference to that object!?

>>>> def inplusplus(value,listObj):
> ...     for i in listObj:
> ...             if i is value:
> ...                     return value
> ...     return False
> ...

def my_in(value, sequence):
    if value in sequence:
        return value
    else:
        return False

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to