[Tutor] Misc question about scoping

ALAN GAULD alan.gauld at btinternet.com
Fri Jun 4 21:02:30 CEST 2010



> > flag = True if  (someValue or another) else False
> >
> I'd prefer the form:
>
>    flag = not not (someValue or another)

Eek! no I'd just cast to a bool:

    flag = bool(someValue or another)

but the if/else form has the Pythonic virtue of explicitness.

Alan G.


More information about the Tutor mailing list