if statement, with function inside it: if (t = Test()) == True:

GC-Martijn gcmartijn at gmail.com
Fri Apr 24 12:00:26 CEST 2009


I'm trying to do a if statement with a function inside it.
I want to use that variable inside that if loop , without defining it.

def Test():
    return 'Vla'

I searching something like this:

if (t = Test()) == 'Vla':
    print t # Vla


if (t = Test()):
    print t # Vla

The long way
t = Test()
if (t == 'Vla':
    print t # must contain Vla


More information about the Python-list mailing list