On 4 jun 2010, at 21:02, ALAN GAULD <alan.ga...@btinternet.com> wrote:


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.


Are you arguing that the if/else form is better than simply casting to bool
because it is more explicit? You could hardly name the cast implicit, it's
right there in your face.

If anything, I'd say the if/else is a more indirect way of expressing te
cast, even more so when you realize bool is called on the expression anyway
by the if statement, to determine its truthiness.

Hugo
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to