<div dir="ltr">good catch, and definitely a distinction beginners should be more cognizant of.<br><br>it's also good to recognize that a call to "bool(match)" would render that statement correct, as the built-in/factory function will return what an object evaluates to (True [re.match object] or/vs.False [None]).<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 10, 2014 at 5:31 PM, Clayton Kirkwood <span dir="ltr"><<a href="mailto:crk@godblessthe.us" target="_blank">crk@godblessthe.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I reported it. I feel all grown up now. Kind of like one of the boys(girls...)<br>
<span class="HOEnZb"><font color="#888888"><br>
Clayton:<)<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
>-----Original Message-----<br>
>From: Tutor [mailto:<a href="mailto:tutor-bounces%2Bcrk">tutor-bounces+crk</a>=<a href="mailto:godblessthe.us@python.org">godblessthe.us@python.org</a>] On<br>
>Behalf Of Ben Finney<br>
>Sent: Monday, November 10, 2014 3:24 PM<br>
>To: <a href="mailto:tutor@python.org">tutor@python.org</a><br>
>Subject: [Tutor] “has a value of True” versus “evaluates true” (was:<br>
>don't understand iteration)<br>
><br>
>"Clayton Kirkwood" <<a href="mailto:crk@godblessthe.us">crk@godblessthe.us</a>> writes:<br>
><br>
>> Also of confusion, the library reference says:<br>
>><br>
>> Match objects always have a boolean value of True. Since match() and<br>
>> search() return None when there is no match, you can test whether<br>
>> there was a match with a simple if statement:<br>
>><br>
>> match = re.search(pattern, string)<br>
>> if match:<br>
>>     process(match)<br>
><br>
>The documentation is incorrect, as you point out: “have a boolean value<br>
>of True” implies that the value is identical to the built-in ‘True’<br>
>constant, which is never the case for these objects.<br>
><br>
>Instead, the passage above should say “evaluates true in a boolean<br>
>context”.<br>
><br>
>Would you be so kind as to report a bug to that effect<br>
><URL:<a href="http://bugs.python.org/" target="_blank">http://bugs.python.org/</a>>?<br>
><br>
>--<br>
> \       “The Vatican is not a state.… a state must have people. There |<br>
>  `\    are no Vaticanians.… No-one gets born in the Vatican except by |<br>
>_o__)        an unfortunate accident.” —Geoffrey Robertson, 2010-09-18 |<br>
>Ben Finney<br>
><br>
>_______________________________________________<br>
>Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
>To unsubscribe or change subscription options:<br>
><a href="https://mail.python.org/mailman/listinfo/tutor" target="_blank">https://mail.python.org/mailman/listinfo/tutor</a><br>
<br>
<br>
_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="https://mail.python.org/mailman/listinfo/tutor" target="_blank">https://mail.python.org/mailman/listinfo/tutor</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>"A computer never does what you want... only what you tell it."<br>    <a href="http://google.com/+WesleyChun" target="_blank">+wesley chun</a> : wescpy at gmail : <a href="http://twitter.com/wescpy" target="_blank">@wescpy</a><br>    Python training & consulting : <a href="http://CyberwebConsulting.com" target="_blank">http://CyberwebConsulting.com</a><br>    "Core Python" books : <a href="http://CorePython.com" target="_blank">http://CorePython.com</a><br>    Python blog: <a href="http://wescpy.blogspot.com" target="_blank">http://wescpy.blogspot.com</a></div></div>
</div>