fixed error about list append() method [thanks G.P.]

This commit is contained in:
Mark Pilgrim
2009-05-16 01:24:58 -04:00
parent 3e357ea4be
commit 7ab07a5abf
+1 -1
View File
@@ -276,7 +276,7 @@ body{counter-reset:h1 2}
<ol>
<li>The <code>extend()</code> method takes a single argument, which is always a list, and adds each of the items of that list to <var>a_list</var>.
<li>If you start with a list of three items and extend it with a list of another three items, you end up with a list of six items.
<li>On the other hand, the <code>append()</code> method takes any number of arguments, each of which can be any datatype. Here, you&#8217;re calling the <code>append()</code> method with a single argument, a list of three items.
<li>On the other hand, the <code>append()</code> method takes a single argument, which can be any datatype. Here, you&#8217;re calling the <code>append()</code> method with a list of three items.
<li>If you start with a list of six items and append a list onto it, you end up with... a list of seven items. Why seven? Because the last item (which you just appended) <em>is itself a list</em>. Lists can contain any type of data, including other lists. That may be what you want, or it may not. But it&#8217;s what you asked for, and it&#8217;s what you got.
</ol>
<h3 id=searchinglists>Searching For Values In A List</h3>