Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: Implicit conversion to boolean in if and while statements (http://www.velocityreviews.com/forums/t948130-re-implicit-conversion-to-boolean-in-if-and-while-statements.html)

Stefan Behnel 07-15-2012 09:17 AM

Re: Implicit conversion to boolean in if and while statements
 
Andrew Berg, 15.07.2012 10:34:
> This has probably been discussed before, but why is there an implicit
> conversion to a boolean in if and while statements?


There isn't. This has nothing to do with "if" or "while".

All objects have a truth value in Python, evaluating to True by default
(object), unless they implement the test themselves.

As Chris said, very convenient.

Stefan



All times are GMT. The time now is 06:09 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.