homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author crkirkwood
Recipients crkirkwood, docs@python
Date 2014年11月11日.01:26:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1415669163.97.0.11938367664.issue22843@psf.upfronthosting.co.za>
In-reply-to
Content
Documentation says:
> Match objects always have a boolean value of True. Since match() and
> search() return None when there is no match, you can test whether 
> there was a match with a simple if statement:
>
> match = re.search(pattern, string)
> if match:
> process(match)
What happens:
blah = <_sre.SRE_Match object; span=(0, 28), match='<BR>Nov. 10, 08:16:09 PM EST'>
 if blah == True:
 print("True")
 if blah:
 print('blah True')
blah True
///
Blah is not True
One suggestion: instead, the passage above should say "evaluates true in a boolean context".
History
Date User Action Args
2014年11月11日 01:26:04crkirkwoodsetrecipients: + crkirkwood, docs@python
2014年11月11日 01:26:03crkirkwoodsetmessageid: <1415669163.97.0.11938367664.issue22843@psf.upfronthosting.co.za>
2014年11月11日 01:26:03crkirkwoodlinkissue22843 messages
2014年11月11日 01:26:03crkirkwoodcreate

AltStyle によって変換されたページ (->オリジナル) /