<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi Oleg, others,</span><div style="font-family:arial,sans-serif;font-size:13px">It's not that it can't be done, just that it does something you don't expect. I've been professionally working with C++ for nine years in large-scale Windows systems, and I do expect a boolean expression return a boolean value.</div>

<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Or, can you show me an example how the developer would benefit of the current behavior? Any operator traditionally considered as boolean will do.</div>

<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Regards,</div><div style="font-family:arial,sans-serif;font-size:13px">Ilkka</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, Jan 17, 2013 at 2:51 PM, Oleg Broytman <span dir="ltr"><<a href="mailto:phd@phdru.name" target="_blank">phd@phdru.name</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Thu, Jan 17, 2013 at 02:44:03PM +0200, Ilkka Pelkonen <<a href="mailto:ica@iki.fi">ica@iki.fi</a>> wrote:<br>
> expected_result = (expected_string != 'TRUE') # Boolean<br>
> element = find_element() # Can return None or an instance of Element<br>
> flag = (element and element.is_visible())<br>
> if flag == expected_result:<br>
> ..# Ok<br>
> ..return<br>
> # Otherwise perform some failure related stuff.<br>
><br>
> This code does not work. What happens on the 'flag' assignment row, is that<br>
> if 'element' is None, the expression returns None, not False. This makes<br>
> the if comparison to fail if expected_result is False, since boolean False<br>
> is not None.<br>
<br>
</div>   No need to change the language. Just do<br>
<br>
flag = bool(element and element.is_visible())<br>
<span class="HOEnZb"><font color="#888888"><br>
Oleg.<br>
--<br>
     Oleg Broytman            <a href="http://phdru.name/" target="_blank">http://phdru.name/</a>            <a href="mailto:phd@phdru.name">phd@phdru.name</a><br>
           Programmers don't die, they just GOSUB without RETURN.<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</font></span></blockquote></div><br></div>