<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The Gahooa Perspective &#187; TypeError</title>
	<atom:link href="http://blog.gahooa.com/tag/typeerror/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.gahooa.com</link>
	<description>Thoughts on Life, Engineering, Technology, Business, and more...</description>
	<lastBuildDate>Tue, 07 Sep 2010 03:56:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.gahooa.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/167b7031b951e9f11655a8ef27c12d71?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>The Gahooa Perspective &#187; TypeError</title>
		<link>http://blog.gahooa.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.gahooa.com/osd.xml" title="The Gahooa Perspective" />
	<atom:link rel='hub' href='http://blog.gahooa.com/?pushpress=hub'/>
		<item>
		<title>TypeError: list indices must be integers</title>
		<link>http://blog.gahooa.com/2010/03/08/211/</link>
		<comments>http://blog.gahooa.com/2010/03/08/211/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 22:50:46 +0000</pubDate>
		<dc:creator>Jason Garber</dc:creator>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[python error]]></category>
		<category><![CDATA[Tuple]]></category>
		<category><![CDATA[TypeError]]></category>

		<guid isPermaLink="false">http://blog.gahooa.com/?p=211</guid>
		<description><![CDATA[You start your day, happily working with dictionaries&#8230;Life is good. &#62;&#62;&#62; mydict = {'key-a': 'value-a', 'key-b': 'value-b'} &#62;&#62;&#62; mydict['key-a'] 'value-a' All of a sudden, storm clouds appear. Your dictionary variable accidentally gets assigned a list, and life is no longer good! &#62;&#62;&#62; mydict = {'key-a': 'value-a', 'key-b': 'value-b'} &#62;&#62;&#62; mydict['key-a'] 'value-a' &#62;&#62;&#62; mydict = [] [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gahooa.com&amp;blog=6218261&amp;post=211&amp;subd=gahooa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You start your day, happily working with dictionaries&#8230;Life is good.</p>
<pre class="brush: python;">
&gt;&gt;&gt; mydict = {'key-a': 'value-a', 'key-b': 'value-b'}
&gt;&gt;&gt; mydict['key-a']
'value-a'
</pre>
<p>All of a sudden, storm clouds appear.  Your dictionary variable <strong>accidentally </strong>gets assigned a list, and life is no longer good!</p>
<pre class="brush: python;">
&gt;&gt;&gt; mydict = {'key-a': 'value-a', 'key-b': 'value-b'}
&gt;&gt;&gt; mydict['key-a']
'value-a'
&gt;&gt;&gt; mydict = []
&gt;&gt;&gt; mydict['key-a']
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
TypeError: list indices must be integers
</pre>
<p>The error message <strong>&quot;TypeError: list indices must be integers&quot;</strong> is generated when you attempt to use a non-int for a index inside the [] operator.</p>
<p>By the way, almost the same message is used if you do this with a tuple:</p>
<p><code>TypeError: tuple indices must be integers</code></p>
<br /> Tagged: <a href='http://blog.gahooa.com/tag/list/'>list</a>, <a href='http://blog.gahooa.com/tag/python/'>Python</a>, <a href='http://blog.gahooa.com/tag/python-error/'>python error</a>, <a href='http://blog.gahooa.com/tag/tuple/'>Tuple</a>, <a href='http://blog.gahooa.com/tag/typeerror/'>TypeError</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gahooa.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gahooa.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gahooa.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gahooa.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gahooa.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gahooa.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gahooa.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gahooa.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gahooa.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gahooa.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gahooa.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gahooa.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gahooa.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gahooa.wordpress.com/211/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gahooa.com&amp;blog=6218261&amp;post=211&amp;subd=gahooa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gahooa.com/2010/03/08/211/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">gahooa</media:title>
		</media:content>
	</item>
	</channel>
</rss>