Added devilish [False] example to show that lists in a boolean context are only based on length [thanks A.H.]

This commit is contained in:
Mark Pilgrim
2009-05-16 01:30:45 -04:00
parent 993366096b
commit 43c1add90d
+3
View File
@@ -315,9 +315,12 @@ ValueError: list.index(x): x not in list</samp></pre>
<samp>no, it's false</samp>
<a><samp class=p>>>> </samp><kbd>is_it_true(['a'])</kbd> <span>&#x2462;</span></a>
<samp>yes, it's true</samp></pre>
<a><samp class=p>>>> </samp><kbd>is_it_true([False])</kbd> <span>&#x2463;</span></a>
<samp>yes, it's true</samp></pre>
<ol>
<li>In a boolean context, an empty list is false.
<li>Any list with at least one item is true.
<li>Any list with at least one item is true. The value of the items is irrelevant.
</ol>
<!--
<h2 id=sets>Sets</h2>