[Python-talk] Can I do this in python?
Paul Lussier
p.lussier at comcast.net
Sat Aug 29 10:36:44 EDT 2009
bruce.labitt at autoliv.com writes:
> Simpler type question...
>
> Can one do the following?
>
> if ( function(a, b) == True ):
> dosomething
> else:
> dosomethingelse
Yes, but you're typing too much:
> if ( function(a, b) ):
> dosomething
> else:
> dosomethingelse
And, if you made this a function call, you could do this:
def doOneThingOrTheOther(a,b):
if ( function(a, b) ):
return dosomething
return dosomethingelse
Then just call doOneThingOrTheOther(a,b)
More information about the Python-talk
mailing list