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

Paul McGuire ptmcg at austin.rr.com
Fri Apr 24 09:24:42 EDT 2009


On Apr 24, 5:00 am, GC-Martijn <gcmart... at gmail.com> wrote:
> Hello,
>
> 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
>

Here is a thread from 3 weeks ago on this very topic, with a couple of
proposed solutions.

http://groups.google.com/group/comp.lang.python/browse_frm/thread/9f8e79fa28d69905/e934c73ee3c2dbc2?hl=en&q=

-- Paul



More information about the Python-list mailing list