<?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; Tuple</title>
	<atom:link href="http://blog.gahooa.com/tag/tuple/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.gahooa.com</link>
	<description>Thoughts on Life, Engineering, Technology, Business, and more...</description>
	<lastBuildDate>Sun, 11 Dec 2011 19:44:53 +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://s2.wp.com/i/buttonw-com.png</url>
		<title>The Gahooa Perspective &#187; Tuple</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>Python: &#8216;tuple&#8217; object is not callable</title>
		<link>http://blog.gahooa.com/2010/09/25/python-tuple-object-is-not-callable/</link>
		<comments>http://blog.gahooa.com/2010/09/25/python-tuple-object-is-not-callable/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 03:49:07 +0000</pubDate>
		<dc:creator>Jason Garber</dc:creator>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Perspective]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[callable]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[hard to find bugs]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tuple]]></category>

		<guid isPermaLink="false">http://blog.gahooa.com/?p=301</guid>
		<description><![CDATA[This can be a bit of an obscure error, if you run into it&#8230;  It looks like this: File ".../CCRM/Content.py", line 202, in Page_Update ('Nav1' , Data.Nav1), TypeError: 'tuple' object is not callable In reality, it&#8217;s typically caused by accidentally forgetting a comma from the line before: Notice that line 9 is missing a comma [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gahooa.com&amp;blog=6218261&amp;post=301&amp;subd=gahooa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This can be a bit of an obscure error, if you run into it&#8230;  It looks like this:</p>
<pre>File ".../CCRM/Content.py", line 202, in Page_Update
    ('Nav1'       , Data.Nav1),
TypeError: 'tuple' object is not callable</pre>
<p>In reality, it&#8217;s typically caused by accidentally forgetting a comma from the line before:</p>
<p><pre class="brush: python;">
    Page_MNID = App.DB.Value('''
      UPDATE
        &quot;Dashboard&quot;.&quot;Page&quot;
      SET
        [Field=Value]
      WHERE True
        AND &quot;Page_MNID&quot; = $Page_MNID
      ''',
      ('ScriptPath' , Data.ScriptPath)
      ('Nav1'       , Data.Nav1),
      ('Nav2_Icon'  , Data.Nav2_Icon),
      ('Nav2_Label' , Data.Nav2_Label),
      ('Title'      , Data.Title),
      ('Active'     , Data.Active),
      Page_MNID     = Data.Page_MNID,
      )
</pre></p>
<p>Notice that line <strong>9</strong> is missing a comma at the end?  That causes python to see this:</p>
<p><pre class="brush: python;">
tuple_object = (&quot;ScriptPath&quot;, Data.ScriptPath&quot;)
tuple_object(&quot;Nav1&quot; , Data.Nav1)  #eg, next tuple looks like params
</pre></p>
<p>Solution?  Just add the comma :)</p>
<br /> Tagged: <a href='http://blog.gahooa.com/tag/bugs/'>bugs</a>, <a href='http://blog.gahooa.com/tag/callable/'>callable</a>, <a href='http://blog.gahooa.com/tag/errors/'>errors</a>, <a href='http://blog.gahooa.com/tag/hard-to-find-bugs/'>hard to find bugs</a>, <a href='http://blog.gahooa.com/tag/programming/'>programming</a>, <a href='http://blog.gahooa.com/tag/python/'>Python</a>, <a href='http://blog.gahooa.com/tag/tuple/'>Tuple</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gahooa.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gahooa.wordpress.com/301/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gahooa.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gahooa.wordpress.com/301/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gahooa.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gahooa.wordpress.com/301/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gahooa.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gahooa.wordpress.com/301/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gahooa.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gahooa.wordpress.com/301/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gahooa.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gahooa.wordpress.com/301/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gahooa.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gahooa.wordpress.com/301/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gahooa.com&amp;blog=6218261&amp;post=301&amp;subd=gahooa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gahooa.com/2010/09/25/python-tuple-object-is-not-callable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">gahooa</media:title>
		</media:content>
	</item>
		<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. All of a sudden, storm clouds appear. Your dictionary variable accidentally gets assigned a list, and life is no longer good! The error message &#34;TypeError: list indices must be integers&#34; is generated when you attempt to use a non-int for a index inside the [] [...]<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>
<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>
<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>
<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>
<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>
		<item>
		<title>What is a tuple?</title>
		<link>http://blog.gahooa.com/2009/09/03/what-is-a-tuple/</link>
		<comments>http://blog.gahooa.com/2009/09/03/what-is-a-tuple/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 22:05:18 +0000</pubDate>
		<dc:creator>Jason Garber</dc:creator>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tuple]]></category>

		<guid isPermaLink="false">http://blog.gahooa.com/?p=151</guid>
		<description><![CDATA[I get asked this from time to time, so for the fun of it, I&#8217;ll post this: Tuples are immutable lists in python (and other languages).  Very lightweight, unchangable arrays.  They are used for storing multiple values in one variable (usually a fixed number of values). x = (1, 2, 3, 'abc') x[0] -&#62; 1 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gahooa.com&amp;blog=6218261&amp;post=151&amp;subd=gahooa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I get asked this from time to time, so for the fun of it, I&#8217;ll post this:</p>
<p>Tuples are immutable lists in python (and other languages).  Very lightweight, unchangable arrays.  They are used for storing multiple values in one variable (usually a fixed number of values).</p>
<pre>x = (1, 2, 3, 'abc')
x[0]
-&gt; 1
x[1] 
-&gt; 2
x[2] 
-&gt; 3
<span style="font-family:Georgia;line-height:19px;white-space:normal;font-size:13px;">
<pre style="font:normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">x[3] 
-&gt; abc</pre>
<div><span style="font-family:Consolas;line-height:18px;font-size:12px;white-space:pre;">x["bob"] </span></div>
<div><span style="font-family:Consolas;line-height:18px;font-size:12px;white-space:pre;">-&gt; TypeError: tuple indices must be integers, not str</span></div>
<div><span style="font-family:Consolas;font-size:small;"><span style="line-height:18px;white-space:pre;"><br />
</span></span></div>
<p></span></pre>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Tuples are immutable lists in python (and other languages).  Very lightweight, unchangable arrays.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">x = (1,2,3)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">x[0] == 1</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">x[1] == 2</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">x[2] == 3</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">x["bob"] == &#8220;tuple indices must be integers&#8221;</div>
<p>A common example is storing x,y coordinances.  You could use a tuple for that:</p>
<pre>point = (12,38)</pre>
<p>Python can unpack tuples also.</p>
<pre>x,y = (12,38)</pre>
<pre>x
-&gt; 12</pre>
<pre>y
-&gt; 38</pre>
<pre></pre>
<p>Enjoy.</p>
<br /> Tagged: Python, Tuple <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gahooa.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gahooa.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gahooa.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gahooa.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gahooa.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gahooa.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gahooa.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gahooa.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gahooa.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gahooa.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gahooa.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gahooa.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gahooa.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gahooa.wordpress.com/151/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.gahooa.com&amp;blog=6218261&amp;post=151&amp;subd=gahooa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.gahooa.com/2009/09/03/what-is-a-tuple/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>
