<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:www.nabble.com,2006:forum-2981</id>
	<title>Nabble - Python - tutor</title>
	<updated>2008-12-02T11:23:02Z</updated>
	<link rel="self" type="application/atom+xml" href="http://www.nabble.com/Python---tutor-f2981.xml" />
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Python---tutor-f2981.html" />
	<subtitle type="html">Discussion for learning programming with Python</subtitle>
	
<entry>
	<id>tag:www.nabble.com,2006:post-20799060</id>
	<title>Re: sqlite3 Python25 parameter binding problem with UPDATEplease help</title>
	<published>2008-12-02T11:23:02Z</published>
	<updated>2008-12-02T11:23:02Z</updated>
	<author>
		<name>aivars</name>
	</author>
	<content type="html">Hello again,
&lt;br&gt;&lt;br&gt;Finally I managed to get it working!
&lt;br&gt;&lt;br&gt;I had to remove [year] braces from the second argument - year. The
&lt;br&gt;reason I used [] was the posts we exchanged recently (7th of November)
&lt;br&gt;about CGI script where it was recommended by Kent that I put [] around
&lt;br&gt;string argument:
&lt;br&gt;&lt;br&gt;Quote
&lt;br&gt;The second argument to execute() is a *sequence* of parameter values.
&lt;br&gt;A string is a sequence of characters, so by passing a plain string you
&lt;br&gt;are saying that each character of the string is a parameter to the
&lt;br&gt;SQL.
&lt;br&gt;&lt;br&gt;Try adding braces around the parameter to make &amp;nbsp;list:
&lt;br&gt;cur.execute(&amp;quot;insert into test (name) values (?)&amp;quot;, [sPath])
&lt;br&gt;&lt;br&gt;Kent
&lt;br&gt;Unquote
&lt;br&gt;&lt;br&gt;Now the year argument is string so I thought I should do the same
&lt;br&gt;again but it is not working.
&lt;br&gt;The reason is of course is that I am new to python and there are so
&lt;br&gt;many things to learn so the question really is why in this case there
&lt;br&gt;were no [] or () necessary?
&lt;br&gt;&lt;br&gt;Thanks in advance
&lt;br&gt;&lt;br&gt;Aivars
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;2008/12/2 aivars &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20799060&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aivars868@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Interestingly, when simply testing like this:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; import sqlite3, sys
&lt;br&gt;&amp;gt; sPATH=r'e:\pythonexamples\aivars2.db'
&lt;br&gt;&amp;gt; oCon=sqlite3.connect(sPATH)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; cur=oCon.cursor()
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; oCon.execute(&amp;quot;&amp;quot;&amp;quot;UPDATE rezerve SET latusaldo = ? WHERE gads = ?
&lt;br&gt;&amp;gt; &amp;quot;&amp;quot;&amp;quot;,(6000.0,'2006'))
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; oCon.commit()
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; it works. Therefore I am stuck since it looks like there is something
&lt;br&gt;&amp;gt; wrong in below function.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Aivars
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 2008/12/2 aivars &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20799060&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aivars868@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&amp;gt;&amp;gt; Alan,
&lt;br&gt;&amp;gt;&amp;gt; Thanks.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Ok I should have been more precise and give more code
&lt;br&gt;&amp;gt;&amp;gt; There is what I do:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; def starpiba(year, month, day):
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;datumsno=str(year+'-01-01') #beginning of year date
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;datumsuz=str(year+'-'+month+'-'+day) #period end date
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;result = (atlikumiBeiguKurss(year, month, day)-
&lt;br&gt;&amp;gt;&amp;gt; atlikumiDienasKurss(year, month, day))
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;##print result
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;oCon=sqlite3.connect(sPATH)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;if result&amp;lt;=0:
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;print abs(result)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oCon.execute(&amp;quot;UPDATE rezerve SET latusaldo =? where gads
&lt;br&gt;&amp;gt;&amp;gt; =?;&amp;quot;,(result, [year]))
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oCon.commit()
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;else:
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;##print 'aivars'
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oCon.execute(&amp;quot;UPDATE rezerve SET latusaldo =? where gads
&lt;br&gt;&amp;gt;&amp;gt; =?;&amp;quot;,(result, [year]))
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Please bear in mind I am a noob in Python and I write spaggeti code.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; There is a table in my sqlite database called rezerve which shows the
&lt;br&gt;&amp;gt;&amp;gt; breakdown of a consolidated reserves item in a consolidated balance
&lt;br&gt;&amp;gt;&amp;gt; sheet report (if that says anything to you) by years. For the previous
&lt;br&gt;&amp;gt;&amp;gt; years the numbers does not change since they are already reported but
&lt;br&gt;&amp;gt;&amp;gt; for the current year it may change month by month until reported.
&lt;br&gt;&amp;gt;&amp;gt; Therefore, I wanted to update the numbers for the current year.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; The above python function works OK.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Thanks
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Aivars
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; 2008/12/2 Alan Gauld &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20799060&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;alan.gauld@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;quot;aivars&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20799060&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aivars868@...&lt;/a&gt;&amp;gt; wrote
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; oCon.execute(&amp;quot;UPDATE rezerve SET latusaldo =? where gads =?;&amp;quot;,(result,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; [year]))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; oCon.commit()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; it throws me the error:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; sqlite3.InterfaceError: error binding parameter 1 probably unsupported
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; type
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; I assume its the [year] value it objects to.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; I'm not sure what you expect SQLite to do with a list as a value, it does
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; not support a list type field.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; All works OK when using INSERT with the same parameters.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Are you sure? You can insert a list into a field?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Maybe I should as this question on sqlite list?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Perhaps but I think it is the list parameter that it doesn't like.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Unless I misunderstand the syntax.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Alan Gauld
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Author of the Learn to Program web site
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20799060&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20799060&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/sqlite3-Python25-parameter-binding-problem-with-UPDATE-please-help-tp20787206p20799060.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20798202</id>
	<title>Re: sqlite3 Python25 parameter binding problem with UPDATEplease help</title>
	<published>2008-12-02T10:33:20Z</published>
	<updated>2008-12-02T10:33:20Z</updated>
	<author>
		<name>aivars</name>
	</author>
	<content type="html">Interestingly, when simply testing like this:
&lt;br&gt;&lt;br&gt;import sqlite3, sys
&lt;br&gt;sPATH=r'e:\pythonexamples\aivars2.db'
&lt;br&gt;oCon=sqlite3.connect(sPATH)
&lt;br&gt;&lt;br&gt;cur=oCon.cursor()
&lt;br&gt;&lt;br&gt;oCon.execute(&amp;quot;&amp;quot;&amp;quot;UPDATE rezerve SET latusaldo = ? WHERE gads = ?
&lt;br&gt;&amp;quot;&amp;quot;&amp;quot;,(6000.0,'2006'))
&lt;br&gt;&lt;br&gt;oCon.commit()
&lt;br&gt;&lt;br&gt;&lt;br&gt;it works. Therefore I am stuck since it looks like there is something
&lt;br&gt;wrong in below function.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&lt;br&gt;Aivars
&lt;br&gt;&lt;br&gt;&lt;br&gt;2008/12/2 aivars &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20798202&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aivars868@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Alan,
&lt;br&gt;&amp;gt; Thanks.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Ok I should have been more precise and give more code
&lt;br&gt;&amp;gt; There is what I do:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; def starpiba(year, month, day):
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;datumsno=str(year+'-01-01') #beginning of year date
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;datumsuz=str(year+'-'+month+'-'+day) #period end date
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;result = (atlikumiBeiguKurss(year, month, day)-
&lt;br&gt;&amp;gt; atlikumiDienasKurss(year, month, day))
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;##print result
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;oCon=sqlite3.connect(sPATH)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;if result&amp;lt;=0:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;print abs(result)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oCon.execute(&amp;quot;UPDATE rezerve SET latusaldo =? where gads
&lt;br&gt;&amp;gt; =?;&amp;quot;,(result, [year]))
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oCon.commit()
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;else:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;##print 'aivars'
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oCon.execute(&amp;quot;UPDATE rezerve SET latusaldo =? where gads
&lt;br&gt;&amp;gt; =?;&amp;quot;,(result, [year]))
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Please bear in mind I am a noob in Python and I write spaggeti code.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; There is a table in my sqlite database called rezerve which shows the
&lt;br&gt;&amp;gt; breakdown of a consolidated reserves item in a consolidated balance
&lt;br&gt;&amp;gt; sheet report (if that says anything to you) by years. For the previous
&lt;br&gt;&amp;gt; years the numbers does not change since they are already reported but
&lt;br&gt;&amp;gt; for the current year it may change month by month until reported.
&lt;br&gt;&amp;gt; Therefore, I wanted to update the numbers for the current year.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The above python function works OK.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Aivars
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 2008/12/2 Alan Gauld &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20798202&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;alan.gauld@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;aivars&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20798202&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aivars868@...&lt;/a&gt;&amp;gt; wrote
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; oCon.execute(&amp;quot;UPDATE rezerve SET latusaldo =? where gads =?;&amp;quot;,(result,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; [year]))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; oCon.commit()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; it throws me the error:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; sqlite3.InterfaceError: error binding parameter 1 probably unsupported
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; type
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I assume its the [year] value it objects to.
&lt;br&gt;&amp;gt;&amp;gt; I'm not sure what you expect SQLite to do with a list as a value, it does
&lt;br&gt;&amp;gt;&amp;gt; not support a list type field.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; All works OK when using INSERT with the same parameters.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Are you sure? You can insert a list into a field?
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Maybe I should as this question on sqlite list?
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Perhaps but I think it is the list parameter that it doesn't like.
&lt;br&gt;&amp;gt;&amp;gt; Unless I misunderstand the syntax.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt; Alan Gauld
&lt;br&gt;&amp;gt;&amp;gt; Author of the Learn to Program web site
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt; Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20798202&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20798202&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/sqlite3-Python25-parameter-binding-problem-with-UPDATE-please-help-tp20787206p20798202.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20796664</id>
	<title>[Fwd: Python Course]</title>
	<published>2008-12-02T08:40:04Z</published>
	<updated>2008-12-02T08:40:04Z</updated>
	<author>
		<name>Jeff Johnson-10</name>
	</author>
	<content type="html">This was forwarded to me from one of our user group members:
&lt;br&gt;&lt;br&gt;&amp;quot;Hi everyone!
&lt;br&gt;&lt;br&gt;I just signed up for an online course in &amp;quot;Web Development with Python&amp;quot;
&lt;br&gt;through DePaul University, which I think you might find interesting:
&lt;br&gt;&lt;a href=&quot;http://ipd.cdm.depaul.edu/wdp/Prog_WDP.htm&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://ipd.cdm.depaul.edu/wdp/Prog_WDP.htm&lt;/a&gt;&lt;br&gt;&lt;br&gt;I talked to the folks in the admissions department and they said they
&lt;br&gt;needed 10 students enrolled in order to go through with the course.
&lt;br&gt;So I told them I would mention this to the python programmers I knew
&lt;br&gt;to try to drum up enough applicants.
&lt;br&gt;&lt;br&gt;Best regards,
&lt;br&gt;&lt;br&gt;John T.&amp;quot;
&lt;br&gt;&lt;br&gt;If anyone has any objection to posting this type of information, please 
&lt;br&gt;let me know. &amp;nbsp;I thought members might be interested in available Python 
&lt;br&gt;courses.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Jeff
&lt;br&gt;&lt;br&gt;Jeff Johnson
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20796664&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jeff@...&lt;/a&gt;
&lt;br&gt;Phoenix Python User Group - &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20796664&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sunpiggies@...&lt;/a&gt;
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20796664&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/-Fwd%3A-Python-Course--tp20796664p20796664.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20791223</id>
	<title>Re: noise function</title>
	<published>2008-12-02T04:32:44Z</published>
	<updated>2008-12-02T04:32:44Z</updated>
	<author>
		<name>Rich Lovely</name>
	</author>
	<content type="html">There's probably something like what you want within the &amp;quot;random&amp;quot; module.
&lt;br&gt;&lt;br&gt;at the interactive prompt, try:
&lt;br&gt;&lt;br&gt;import random
&lt;br&gt;help(random)
&lt;br&gt;&lt;br&gt;---
&lt;br&gt;Richard &amp;quot;Roadie Rich&amp;quot; Lovely, part of the JNP|UK Famile
&lt;br&gt;www.theJNP.com
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;2008/12/2 Alan Gauld &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20791223&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;alan.gauld@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;quot;Christopher Spears&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20791223&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;cspears2002@...&lt;/a&gt;&amp;gt; wrote
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Does anyone know if python has a noise function?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What kind of noise function?
&lt;br&gt;&amp;gt; What would you expect it to produce?
&lt;br&gt;&amp;gt; A stream of random numbers perhaps?
&lt;br&gt;&amp;gt; A single number each time it is called?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; And which noise profile should it follow?
&lt;br&gt;&amp;gt; Or would it be a multi dimensional noise model?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I don't know of any such function and I'm not sure wiothout more details how
&lt;br&gt;&amp;gt; it would work in a general way even if it did exist. Can you give a
&lt;br&gt;&amp;gt; speciofic example of what you expect?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; Alan Gauld
&lt;br&gt;&amp;gt; Author of the Learn to Program web site
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20791223&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20791223&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/noise-function-tp20786497p20791223.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20788426</id>
	<title>Re: cgi on novell/Appache</title>
	<published>2008-12-02T01:01:21Z</published>
	<updated>2008-12-02T01:01:21Z</updated>
	<author>
		<name>Alan Gauld</name>
	</author>
	<content type="html">&amp;quot;Jim Morcombe&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20788426&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jmorcombe@...&lt;/a&gt;&amp;gt; wrote
&lt;br&gt;&lt;br&gt;&amp;gt; running under Novel. &amp;nbsp;I know absolutely nothing about novell. &amp;nbsp;I 
&lt;br&gt;&amp;gt; need to have the first line of the script point to the Python 
&lt;br&gt;&amp;gt; interpretter,
&lt;br&gt;&lt;br&gt;I don't think that will do anything under Novell, assuming you mean
&lt;br&gt;the Novell network OS and not Novell Linux? If its NovelWare then
&lt;br&gt;you need to set the PATH to Python and set up the file associatiion
&lt;br&gt;between your .py file and python. Then you need to use the cgi-bin
&lt;br&gt;folder to store the file rather than your web app space.
&lt;br&gt;&lt;br&gt;At least that's what I did the last time I used a DOS based
&lt;br&gt;server - but that was about 12 years ago!
&lt;br&gt;&lt;br&gt;If it's Novell Linux the standard /env/python should work.
&lt;br&gt;&lt;br&gt;&amp;gt; around on it. &amp;nbsp;I have to change the script, give it to the admin guy 
&lt;br&gt;&amp;gt; and let him load it. &amp;nbsp;He knows nothing about cgi, python, etc. )
&lt;br&gt;&lt;br&gt;HTH,
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Alan Gauld
&lt;br&gt;Author of the Learn to Program web site
&lt;br&gt;&lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20788426&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/cgi-on-novell-Appache-tp20788087p20788426.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20788359</id>
	<title>Re: sqlite3 Python25 parameter binding problem with UPDATEplease help</title>
	<published>2008-12-02T00:55:17Z</published>
	<updated>2008-12-02T00:55:17Z</updated>
	<author>
		<name>Alan Gauld</name>
	</author>
	<content type="html">&lt;br&gt;&amp;quot;aivars&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20788359&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;aivars868@...&lt;/a&gt;&amp;gt; wrote
&lt;br&gt;&lt;br&gt;&amp;gt; oCon.execute(&amp;quot;UPDATE rezerve SET latusaldo =? where gads 
&lt;br&gt;&amp;gt; =?;&amp;quot;,(result, [year]))
&lt;br&gt;&amp;gt; oCon.commit()
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; it throws me the error:
&lt;br&gt;&amp;gt; sqlite3.InterfaceError: error binding parameter 1 probably 
&lt;br&gt;&amp;gt; unsupported type
&lt;br&gt;&lt;br&gt;I assume its the [year] value it objects to.
&lt;br&gt;I'm not sure what you expect SQLite to do with a list as a value, it 
&lt;br&gt;does
&lt;br&gt;not support a list type field.
&lt;br&gt;&lt;br&gt;&amp;gt; All works OK when using INSERT with the same parameters.
&lt;br&gt;&lt;br&gt;Are you sure? You can insert a list into a field?
&lt;br&gt;&lt;br&gt;&amp;gt; Maybe I should as this question on sqlite list?
&lt;br&gt;&lt;br&gt;Perhaps but I think it is the list parameter that it doesn't like.
&lt;br&gt;Unless I misunderstand the syntax.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Alan Gauld
&lt;br&gt;Author of the Learn to Program web site
&lt;br&gt;&lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20788359&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/sqlite3-Python25-parameter-binding-problem-with-UPDATE-please-help-tp20787206p20788359.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20788241</id>
	<title>Re: noise function</title>
	<published>2008-12-02T00:51:10Z</published>
	<updated>2008-12-02T00:51:10Z</updated>
	<author>
		<name>Alan Gauld</name>
	</author>
	<content type="html">&lt;br&gt;&amp;quot;Christopher Spears&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20788241&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;cspears2002@...&lt;/a&gt;&amp;gt; wrote 
&lt;br&gt;&lt;br&gt;&amp;gt; Does anyone know if python has a noise function?
&lt;br&gt;&lt;br&gt;What kind of noise function?
&lt;br&gt;What would you expect it to produce?
&lt;br&gt;A stream of random numbers perhaps?
&lt;br&gt;A single number each time it is called?
&lt;br&gt;&lt;br&gt;And which noise profile should it follow?
&lt;br&gt;Or would it be a multi dimensional noise model?
&lt;br&gt;&lt;br&gt;I don't know of any such function and I'm not sure wiothout 
&lt;br&gt;more details how it would work in a general way even if it 
&lt;br&gt;did exist. Can you give a speciofic example of what you expect?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Alan Gauld
&lt;br&gt;Author of the Learn to Program web site
&lt;br&gt;&lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20788241&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/noise-function-tp20786497p20788241.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20788087</id>
	<title>cgi on novell/Appache</title>
	<published>2008-12-02T00:39:15Z</published>
	<updated>2008-12-02T00:39:15Z</updated>
	<author>
		<name>Jim Morcombe</name>
	</author>
	<content type="html">I have a cgi script that I want to get running on an Apache server 
&lt;br&gt;running under Novel. &amp;nbsp;I know absolutely nothing about novell. &amp;nbsp;I need to 
&lt;br&gt;have the first line of the script point to the Python interpretter, but 
&lt;br&gt;have no idea where it is. &amp;nbsp;(I don't have access to the server to play 
&lt;br&gt;around on it. &amp;nbsp;I have to change the script, give it to the admin guy and 
&lt;br&gt;let him load it. &amp;nbsp;He knows nothing about cgi, python, etc. )
&lt;br&gt;&lt;br&gt;What is the novel equivalent of &amp;quot;/usr/bin/python&amp;quot;?
&lt;br&gt;&lt;br&gt;Jim
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20788087&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/cgi-on-novell-Appache-tp20788087p20788087.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20787206</id>
	<title>sqlite3 Python25 parameter binding problem with UPDATE please help</title>
	<published>2008-12-01T23:12:54Z</published>
	<updated>2008-12-01T23:12:54Z</updated>
	<author>
		<name>aivars</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;Does sqlite3 in python 2.5 supports parameter bindings in UPDATE
&lt;br&gt;statement? When I do like the following:
&lt;br&gt;&lt;br&gt;oCon.execute(&amp;quot;UPDATE rezerve SET latusaldo =? where gads =?;&amp;quot;,(result, [year]))
&lt;br&gt;oCon.commit()
&lt;br&gt;&lt;br&gt;it throws me the error:
&lt;br&gt;sqlite3.InterfaceError: error binding parameter 1 probably unsupported type
&lt;br&gt;&lt;br&gt;All works OK when using INSERT with the same parameters.
&lt;br&gt;&lt;br&gt;On Google I found that python with MySQL supports this syntax (sorry I
&lt;br&gt;am not able to find the link now) but I am not able to get it working
&lt;br&gt;with sqlite3
&lt;br&gt;&lt;br&gt;Thanks in advance
&lt;br&gt;&lt;br&gt;Maybe I should as this question on sqlite list?
&lt;br&gt;&lt;br&gt;Aivars
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20787206&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/sqlite3-Python25-parameter-binding-problem-with-UPDATE-please-help-tp20787206p20787206.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20786497</id>
	<title>noise function</title>
	<published>2008-12-01T21:43:41Z</published>
	<updated>2008-12-01T21:43:41Z</updated>
	<author>
		<name>Christopher Spears</name>
	</author>
	<content type="html">Hi!
&lt;br&gt;&lt;br&gt;Does anyone know if python has a noise function?
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20786497&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/noise-function-tp20786497p20786497.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20785780</id>
	<title>I asked about loops</title>
	<published>2008-12-01T19:57:12Z</published>
	<updated>2008-12-01T19:57:12Z</updated>
	<author>
		<name>WM-15</name>
	</author>
	<content type="html">and your response was most gratifying. &amp;nbsp;I think that I now have a handle 
&lt;br&gt;&amp;nbsp; on the subject and want to say, &amp;quot;Thanks to you all.&amp;quot; &amp;nbsp;WM
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20785780&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/I-asked-about-loops-tp20785780p20785780.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20785207</id>
	<title>Re: attribute of built-in type</title>
	<published>2008-12-01T19:03:40Z</published>
	<updated>2008-12-01T19:03:40Z</updated>
	<author>
		<name>Kent Johnson</name>
	</author>
	<content type="html">Here is an idea that might help - you do have some control over
&lt;br&gt;assignment to attributes of an object. If you stored your objects in
&lt;br&gt;another object you could assign __name__ attributes automatically. For
&lt;br&gt;example:
&lt;br&gt;&lt;br&gt;class Container(object):
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; def __setattr__(self, name, value):
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if not hasattr(value, '__name__'):
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;value.__name__ = name
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; except:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pass
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;object.__setattr__(self, name, value)
&lt;br&gt;&lt;br&gt;class Item(object):
&lt;br&gt;&amp;nbsp; &amp;nbsp;pass
&lt;br&gt;&lt;br&gt;c = Container()
&lt;br&gt;c.s = 'string'
&lt;br&gt;c.i = Item()
&lt;br&gt;&lt;br&gt;print c.i.__name__ &amp;nbsp; # i
&lt;br&gt;print c.s.__name__ &amp;nbsp; # AttributeError, can't add __name__ attribute to string
&lt;br&gt;&lt;br&gt;Kent
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20785207&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/attribute-of-built-in-type-tp20740413p20785207.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20785181</id>
	<title>Re: 'for' loops</title>
	<published>2008-12-01T19:00:36Z</published>
	<updated>2008-12-01T19:00:36Z</updated>
	<author>
		<name>Kent Johnson</name>
	</author>
	<content type="html">On Mon, Dec 1, 2008 at 7:56 PM, John Fouhy &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20785181&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;john@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; [1] Technically, it iterates over an iterator, which you can think of
&lt;br&gt;&amp;gt; as an object that behaves like a list when you throw it at a for loop.
&lt;br&gt;&lt;br&gt;The object of the 'in' must be an iterable, which is an object that
&lt;br&gt;can produce an iterator when asked. A list is an iterable, not an
&lt;br&gt;iterator.
&lt;br&gt;&lt;br&gt;Kent
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20785181&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/%27for%27-loops-tp20783867p20785181.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20784931</id>
	<title>Re: try except block for multiple statements</title>
	<published>2008-12-01T18:31:26Z</published>
	<updated>2008-12-01T18:31:26Z</updated>
	<author>
		<name>Bob Gailer</name>
	</author>
	<content type="html">Bryan Fodness wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I would like to use a try except to see if a value exists. &amp;nbsp;But, when 
&lt;br&gt;&amp;gt; I use the following, if a does not exist it exits. &amp;nbsp;I understand why 
&lt;br&gt;&amp;gt; this does this, but is there a way to get b,c, and d if a does not 
&lt;br&gt;&amp;gt; exist without using a try except for every statement?
&lt;br&gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt; try:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; fo.write(&amp;quot;a = %s\n&amp;quot; %plan.a)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; fo.write(&amp;quot;b = %s\n&amp;quot; %plan.b)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; fo.write(&amp;quot;c = %s\n&amp;quot; %plan.c)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; fo.write(&amp;quot;d = %s\n&amp;quot; %plan.d)
&lt;br&gt;&amp;gt; except AttributeError:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; pass
&lt;br&gt;&amp;gt;
&lt;/div&gt;def foo(obj, attr):
&lt;br&gt;&amp;nbsp; val = getattr(obj, attr, None)
&lt;br&gt;&amp;nbsp; if val is not None:
&lt;br&gt;&amp;nbsp; &amp;nbsp; obj.write(&amp;quot;%s = %s\n&amp;quot; % (attr, val))
&lt;br&gt;foo(plan, &amp;quot;a&amp;quot;)
&lt;br&gt;foo(plan, &amp;quot;b&amp;quot;)
&lt;br&gt;foo(plan, &amp;quot;c&amp;quot;)
&lt;br&gt;foo(plan, &amp;quot;d&amp;quot;)
&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; &amp;quot;Any intelligent fool can make things bigger, more complex, and more 
&lt;br&gt;&amp;gt; violent. It takes a touch of genius - and a lot of courage - to move 
&lt;br&gt;&amp;gt; in the opposite direction. &amp;quot; &amp;nbsp;-Albert Einstein
&lt;br&gt;&amp;gt; ------------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784931&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Bob Gailer
&lt;br&gt;Chapel Hill NC 
&lt;br&gt;919-636-4239
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784931&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/try-except-block-for-multiple-statements-tp20784532p20784931.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20784554</id>
	<title>Re: try except block for multiple statements</title>
	<published>2008-12-01T17:54:26Z</published>
	<updated>2008-12-01T17:54:26Z</updated>
	<author>
		<name>John Fouhy</name>
	</author>
	<content type="html">On 02/12/2008, Bryan Fodness &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784554&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bryan.fodness@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I would like to use a try except to see if a value exists. &amp;nbsp;But, when I use
&lt;br&gt;&amp;gt; the following, if a does not exist it exits. &amp;nbsp;I understand why this does
&lt;br&gt;&amp;gt; this, but is there a way to get b,c, and d if a does not exist without using
&lt;br&gt;&amp;gt; a try except for every statement?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; try:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; fo.write(&amp;quot;a = %s\n&amp;quot; %plan.a)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; fo.write(&amp;quot;b = %s\n&amp;quot; %plan.b)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; fo.write(&amp;quot;c = %s\n&amp;quot; %plan.c)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; fo.write(&amp;quot;d = %s\n&amp;quot; %plan.d)
&lt;br&gt;&amp;gt; except AttributeError:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; pass
&lt;/div&gt;&lt;br&gt;AFAIK, no -- but you could always use a loop.
&lt;br&gt;&lt;br&gt;attrs = ['a', 'b', 'c', 'd']
&lt;br&gt;for attr in attrs:
&lt;br&gt;&amp;nbsp; try:
&lt;br&gt;&amp;nbsp; &amp;nbsp; fo.write('A = %s\n' % getattr(plan, attr))
&lt;br&gt;&amp;nbsp; except AttributeError:
&lt;br&gt;&amp;nbsp; &amp;nbsp; pass
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;John.
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784554&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/try-except-block-for-multiple-statements-tp20784532p20784554.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20784507</id>
	<title>Re: converting processing code to python code</title>
	<published>2008-12-01T17:49:36Z</published>
	<updated>2008-12-01T17:49:36Z</updated>
	<author>
		<name>Alan Gauld</name>
	</author>
	<content type="html">&lt;br&gt;&amp;quot;Erica Osher&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784507&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;eosher@...&lt;/a&gt;&amp;gt; wrote
&lt;br&gt;&lt;br&gt;&amp;gt;I wrote the original code in a program called Processing. (
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://processing.org/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://processing.org/&lt;/a&gt;)
&lt;br&gt;&lt;br&gt;Having had a look at the web site it is obvious that the hardest bit
&lt;br&gt;of porting the Processing code to Python is that Python does not
&lt;br&gt;support all the visual drawing functions that Processing does. Most
&lt;br&gt;of them can be replicated by writing equivalent functions in Python
&lt;br&gt;but that is a lot of work - effectively building a python vesion of
&lt;br&gt;Processing! (That would be an exellent project BTW but not
&lt;br&gt;one for a beginner!)
&lt;br&gt;&lt;br&gt;I tried a Google search. The best I could find was:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://i.document.m05.de/?p=483&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://i.document.m05.de/?p=483&lt;/a&gt;&lt;br&gt;&lt;br&gt;which suggests using Jython whicjh allows you to call the Java
&lt;br&gt;processing libraies/classes from within Python code. But to
&lt;br&gt;understand it I think you still need to go through the tutorials 
&lt;br&gt;first.
&lt;br&gt;&lt;br&gt;HTH,
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Alan Gauld
&lt;br&gt;Author of the Learn to Program web site
&lt;br&gt;&lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784507&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/converting-processing-code-to-python-code-tp20780219p20784507.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20784532</id>
	<title>try except block for multiple statements</title>
	<published>2008-12-01T17:44:20Z</published>
	<updated>2008-12-01T17:44:20Z</updated>
	<author>
		<name>bfodness</name>
	</author>
	<content type="html">&lt;div&gt;I would like to use a try except&amp;nbsp;to see if a value exists.&amp;nbsp; But, when I use the following, if a does not exist it exits.&amp;nbsp; I understand why this does this, but is there a way to get b,c, and d if a does not exist without using a try except for every statement?&lt;/div&gt;

&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;try:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fo.write(&amp;quot;a = %s\n&amp;quot; %plan.a)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fo.write(&amp;quot;b = %s\n&amp;quot; %plan.b)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fo.write(&amp;quot;c = %s\n&amp;quot; %plan.c)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fo.write(&amp;quot;d = %s\n&amp;quot; %plan.d)&lt;br&gt;except AttributeError:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&lt;/div&gt;
&lt;div&gt;&lt;br&gt;-- &lt;br&gt;&amp;quot;Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. &amp;quot; &amp;nbsp;-Albert Einstein&lt;br&gt;&lt;/div&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784532&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/try-except-block-for-multiple-statements-tp20784532p20784532.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20784437</id>
	<title>Re: converting processing code to python code</title>
	<published>2008-12-01T17:41:34Z</published>
	<updated>2008-12-01T17:41:34Z</updated>
	<author>
		<name>Alan Gauld</name>
	</author>
	<content type="html">&lt;br&gt;&amp;quot;Erica Osher&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784437&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;eosher@...&lt;/a&gt;&amp;gt; wrote 
&lt;br&gt;&lt;br&gt;&amp;gt;I wrote the original code in a program called Processing. (
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://processing.org/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://processing.org/&lt;/a&gt;)
&lt;br&gt;&lt;br&gt;Aha! The language is actually called Processing. Now that's 
&lt;br&gt;a new one on me. Thanks for the link, it does help to have 
&lt;br&gt;the context. :-)
&lt;br&gt;&lt;br&gt;Now the next question, are you experienced in Processing 
&lt;br&gt;or are you a beginner there too? If you are experienced in 
&lt;br&gt;another language the best tutiorial is the standard Python 
&lt;br&gt;tutorial found on the Python website. If you are a beginner 
&lt;br&gt;in Processing as well stick to the newbies tutors I mentioned 
&lt;br&gt;last time.
&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Alan Gauld
&lt;br&gt;Author of the Learn to Program web site
&lt;br&gt;&lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784437&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/converting-processing-code-to-python-code-tp20780219p20784437.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20784308</id>
	<title>Re: converting processing code to python code</title>
	<published>2008-12-01T17:28:10Z</published>
	<updated>2008-12-01T17:28:10Z</updated>
	<author>
		<name>Erica Osher</name>
	</author>
	<content type="html">I wrote the original code in a program called Processing. (&lt;a href=&quot;http://processing.org/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://processing.org/&lt;/a&gt;)&lt;br&gt;
&lt;br&gt;
Thanks for your advice, I definitely need some tutorials.&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Mon, Dec 1, 2008 at 8:23 PM, Alan Gauld &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784308&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;alan.gauld@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;div class=&quot;Ih2E3d&quot;&gt;&amp;quot;Erica Osher&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784308&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;eosher@...&lt;/a&gt;&amp;gt; wrote&lt;br&gt;

&lt;br&gt;
&lt;/div&gt;&lt;div class=&quot;Ih2E3d&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
The code was originally created for a Processing Project and I&amp;#39;m just&lt;br&gt;
starting to learn python and I&amp;#39;d like to build on this code.&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;&lt;/div&gt;
The fact that you still don&amp;#39;t tell us what the original language is suggests&lt;br&gt;
you are not a very experienced programmer in any language. Is that&lt;br&gt;
assumption correct?&lt;div class=&quot;Ih2E3d&quot;&gt;&lt;br&gt;
&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
The syntax error I get is&lt;br&gt;
&lt;br&gt;
*Traceback (most recent call last):&lt;br&gt;
&amp;nbsp;File &amp;quot;nodebox/gui/mac/__init__.pyo&amp;quot;, line 332, in _compileScript&lt;br&gt;
&amp;nbsp;File &amp;quot;&amp;lt;untitled&amp;gt;&amp;quot;, line 8&lt;br&gt;
 &amp;nbsp; &amp;nbsp;int x1 = 5;&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^&lt;br&gt;
SyntaxError: invalid syntax&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;&lt;/div&gt;
In Python variables are just names that refer to objects. The objects&lt;br&gt;
can be of any type so we don&amp;#39;t need to declare them as int, float,&lt;br&gt;
char etc. You just need&lt;br&gt;
&lt;br&gt;
x1 = 5&lt;br&gt;
&lt;br&gt;
No semi colons are needed either.&lt;br&gt;
&lt;br&gt;
However since this is such a basic Python statement I do think&lt;br&gt;
you should take an hour or two to go through some of the complete&lt;br&gt;
beginners tutorials found here:&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://wiki.python.org/moin/BeginnersGuide/NonProgrammers&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://wiki.python.org/moin/BeginnersGuide/NonProgrammers&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Try mine if you like but there is a variety of styles for you to choose from.&lt;br&gt;
&lt;br&gt;
Once you are familiar with the basics try converting your code again&lt;br&gt;
and ask specific questions here for help. That will be much more&lt;br&gt;
efficient for all of us than simply randomly trying things then asking&lt;br&gt;
for help.&lt;br&gt;
&lt;br&gt;
HTH,&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;Wj3C7c&quot;&gt;&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Alan Gauld&lt;br&gt;
Author of the Learn to Program web site&lt;br&gt;
&lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt; &lt;br&gt;
&lt;br&gt;
_______________________________________________&lt;br&gt;
Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784308&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Erica Osher&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784308&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/converting-processing-code-to-python-code-tp20780219p20784308.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20784326</id>
	<title>Re: Tutor Digest, Vol 58, Issue 2</title>
	<published>2008-12-01T17:27:08Z</published>
	<updated>2008-12-01T17:27:08Z</updated>
	<author>
		<name>Alan Gauld</name>
	</author>
	<content type="html">&lt;br&gt;&amp;quot;W W&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784326&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;srilyk@...&lt;/a&gt;&amp;gt; wrote
&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; for x in range(3):
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; but the OP was looping from 3 to 1, and that's the easiest way I 
&lt;br&gt;&amp;gt; knew of.
&lt;br&gt;&lt;br&gt;Yes, but they weren't using the counter so it didn't matter which
&lt;br&gt;way they looped. I suspect the decrement pattern was just the one
&lt;br&gt;they were most familiar &amp;nbsp;with in some other language (like Java? or 
&lt;br&gt;VB?)
&lt;br&gt;&lt;br&gt;Alan G 
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784326&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Re%3A-Tutor-Digest%2C-Vol-58%2C-Issue-2-tp20779752p20784326.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20784280</id>
	<title>Re: converting processing code to python code</title>
	<published>2008-12-01T17:23:59Z</published>
	<updated>2008-12-01T17:23:59Z</updated>
	<author>
		<name>Alan Gauld</name>
	</author>
	<content type="html">&amp;quot;Erica Osher&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784280&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;eosher@...&lt;/a&gt;&amp;gt; wrote
&lt;br&gt;&lt;br&gt;&amp;gt; The code was originally created for a Processing Project and I'm 
&lt;br&gt;&amp;gt; just
&lt;br&gt;&amp;gt; starting to learn python and I'd like to build on this code.
&lt;br&gt;&lt;br&gt;The fact that you still don't tell us what the original language is 
&lt;br&gt;suggests
&lt;br&gt;you are not a very experienced programmer in any language. Is that
&lt;br&gt;assumption correct?
&lt;br&gt;&lt;br&gt;&amp;gt; The syntax error I get is
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; *Traceback (most recent call last):
&lt;br&gt;&amp;gt; &amp;nbsp;File &amp;quot;nodebox/gui/mac/__init__.pyo&amp;quot;, line 332, in _compileScript
&lt;br&gt;&amp;gt; &amp;nbsp;File &amp;quot;&amp;lt;untitled&amp;gt;&amp;quot;, line 8
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; int x1 = 5;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;^
&lt;br&gt;&amp;gt; SyntaxError: invalid syntax
&lt;br&gt;&lt;br&gt;In Python variables are just names that refer to objects. The objects
&lt;br&gt;can be of any type so we don't need to declare them as int, float,
&lt;br&gt;char etc. You just need
&lt;br&gt;&lt;br&gt;x1 = 5
&lt;br&gt;&lt;br&gt;No semi colons are needed either.
&lt;br&gt;&lt;br&gt;However since this is such a basic Python statement I do think
&lt;br&gt;you should take an hour or two to go through some of the complete
&lt;br&gt;beginners tutorials found here:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://wiki.python.org/moin/BeginnersGuide/NonProgrammers&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://wiki.python.org/moin/BeginnersGuide/NonProgrammers&lt;/a&gt;&lt;br&gt;&lt;br&gt;Try mine if you like but there is a variety of styles for you to 
&lt;br&gt;choose from.
&lt;br&gt;&lt;br&gt;Once you are familiar with the basics try converting your code again
&lt;br&gt;and ask specific questions here for help. That will be much more
&lt;br&gt;efficient for all of us than simply randomly trying things then asking
&lt;br&gt;for help.
&lt;br&gt;&lt;br&gt;HTH,
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Alan Gauld
&lt;br&gt;Author of the Learn to Program web site
&lt;br&gt;&lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784280&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/converting-processing-code-to-python-code-tp20780219p20784280.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20784206</id>
	<title>Re: 'for' loops</title>
	<published>2008-12-01T17:17:41Z</published>
	<updated>2008-12-01T17:17:41Z</updated>
	<author>
		<name>Alan Gauld</name>
	</author>
	<content type="html">&lt;br&gt;&amp;quot;WM.&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784206&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wferguson1@...&lt;/a&gt;&amp;gt; wrote
&lt;br&gt;&lt;br&gt;&amp;gt;I recently asked a question about 'for' loops, expecting them to be 
&lt;br&gt;&amp;gt;similar to 'for-next' loops. I have looked at several on-line tutors 
&lt;br&gt;&amp;gt;but am still in the dark about what 'for' loops do.
&lt;br&gt;&lt;br&gt;Python for loops are like foreach loops in other languages.
&lt;br&gt;A Python for loop executes a bit of code for each element
&lt;br&gt;in a sequence (list, string, dictionary, set, file etc)
&lt;br&gt;It will keep looping until it runs out of items in the
&lt;br&gt;sequence.
&lt;br&gt;&lt;br&gt;Thus to print each letter in a string:
&lt;br&gt;&lt;br&gt;mystring = 'foobar'
&lt;br&gt;for ch in mystring:
&lt;br&gt;&amp;nbsp; &amp;nbsp;print ch
&lt;br&gt;&lt;br&gt;Or to print each element of a list:
&lt;br&gt;&lt;br&gt;mlist = [1,'2,'a',45, True]
&lt;br&gt;for item in mylist:
&lt;br&gt;&amp;nbsp; &amp;nbsp; print item
&lt;br&gt;&lt;br&gt;And if you want to loop for a fixed number of iterations simply 
&lt;br&gt;construct
&lt;br&gt;a list with that number of elements. The range() function does that 
&lt;br&gt;for
&lt;br&gt;us, thus:
&lt;br&gt;&lt;br&gt;for n in range(12):
&lt;br&gt;&amp;nbsp; &amp;nbsp; print 'hi'
&lt;br&gt;&lt;br&gt;will print 'hi' 12 times.
&lt;br&gt;&lt;br&gt;&amp;gt; Does anyone have a plain English about the use of 'for' loops?
&lt;br&gt;&amp;gt; Are 'while' loops the only way Python runs a sub-routine over &amp; 
&lt;br&gt;&amp;gt; over?
&lt;br&gt;&lt;br&gt;while loops are used much less in Python than in other languages
&lt;br&gt;because for loops are so powerful.
&lt;br&gt;while lops are generally used in cases where you don't know how
&lt;br&gt;many times you need to loop or you want to loop 'forever'.
&lt;br&gt;&lt;br&gt;while True:
&lt;br&gt;&amp;nbsp; &amp;nbsp; print 'Can't stop me now!'
&lt;br&gt;&lt;br&gt;will keep on looping until you close the program
&lt;br&gt;&lt;br&gt;c = 0
&lt;br&gt;while c != -1:
&lt;br&gt;&amp;nbsp; &amp;nbsp; c = int(raw_input('Enter a number(-1 to stop) '))
&lt;br&gt;&amp;nbsp; &amp;nbsp; print c
&lt;br&gt;&lt;br&gt;will keep looping until the user enters -1
&lt;br&gt;&lt;br&gt;More info and a comparison with JabaScript and VBScript can be
&lt;br&gt;found in my tutor in the looping topic.
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Alan Gauld
&lt;br&gt;Author of the Learn to Program web site
&lt;br&gt;&lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784206&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/%27for%27-loops-tp20783867p20784206.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20784013</id>
	<title>Re: 'for' loops</title>
	<published>2008-12-01T16:56:17Z</published>
	<updated>2008-12-01T16:56:17Z</updated>
	<author>
		<name>John Fouhy</name>
	</author>
	<content type="html">On 02/12/2008, WM. &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784013&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wferguson1@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; I recently asked a question about 'for' loops, expecting them to be similar
&lt;br&gt;&amp;gt; to 'for-next' loops. I have looked at several on-line tutors but &amp;nbsp;am still
&lt;br&gt;&amp;gt; in the dark about what 'for' loops do.
&lt;br&gt;&amp;gt; &amp;nbsp;Does anyone have a plain English about the use of 'for' loops?
&lt;br&gt;&amp;gt; &amp;nbsp;Are 'while' loops the only way Python runs a sub-routine over &amp; over?
&lt;br&gt;&lt;br&gt;I'm not sure exactly what you understand by a &amp;quot;for-next loop&amp;quot;.
&lt;br&gt;&lt;br&gt;A for loop, essentially, iterates over a list [1]. &amp;nbsp;e.g.
&lt;br&gt;&lt;br&gt;for fruit in ['apple', 'pear', 'banana', 'tomato']:
&lt;br&gt;&amp;nbsp; &amp;nbsp; print fruit
&lt;br&gt;&lt;br&gt;The loop will set the variable 'fruit' to be 'apple', 'pear', etc. on
&lt;br&gt;each pass through the loop.
&lt;br&gt;&lt;br&gt;If you just want to do something n times, the usual idiom is:
&lt;br&gt;&lt;br&gt;for i in range(n):
&lt;br&gt;&amp;nbsp; &amp;nbsp; # do something, possibly involving i
&lt;br&gt;&lt;br&gt;range(n) is a function that will produce the list [0, 1, 2, ..., n-1].
&lt;br&gt;&lt;br&gt;Tutorials should cover this, so I'm not sure if I'm telling you
&lt;br&gt;anything new. &amp;nbsp;If there's something particular you're stuck on, ask
&lt;br&gt;:-)
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;John.
&lt;br&gt;&lt;br&gt;[1] Technically, it iterates over an iterator, which you can think of
&lt;br&gt;as an object that behaves like a list when you throw it at a for loop.
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20784013&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/%27for%27-loops-tp20783867p20784013.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20783971</id>
	<title>Re: 'for' loops</title>
	<published>2008-12-01T16:53:28Z</published>
	<updated>2008-12-01T16:53:28Z</updated>
	<author>
		<name>W W-2</name>
	</author>
	<content type="html">On Mon, Dec 1, 2008 at 6:44 PM, WM. &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783971&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wferguson1@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
I recently asked a question about &amp;#39;for&amp;#39; loops, expecting them to be similar to &amp;#39;for-next&amp;#39; loops. I have looked at several on-line tutors but &amp;nbsp;am still in the dark about what &amp;#39;for&amp;#39; loops do.&lt;br&gt;
Does anyone have a plain English about the use of &amp;#39;for&amp;#39; loops?&lt;br&gt;
Are &amp;#39;while&amp;#39; loops the only way Python runs a sub-routine over &amp;amp; over?&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;For loops are mainly used when you want a specific number of iterations, such as looping over the elements of a list. In C/C++ you would do something like this:&lt;br&gt;
&lt;br&gt;int myarray[] = {1, 2, 3, 4, 5};&lt;br&gt;for(int x = 0; x &amp;lt; 5; x++)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&amp;quot;%d&amp;quot;, myarray[x])&lt;br&gt;&lt;br&gt;In python it would be much cleaner:&lt;br&gt;&lt;br&gt;myarray = [1, 2, 3, 4, 5]&lt;br&gt;for x in myarray:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print x&lt;br&gt;
&lt;br&gt;HTH,&lt;br&gt;Wayne&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;-- &lt;br&gt;To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness, every vice, has found its defenders, its rhetoric, its ennoblement and exaltation, but stupidity hasn't. - Primo Levi&lt;br&gt;

&lt;br /&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783971&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/%27for%27-loops-tp20783867p20783971.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20783965</id>
	<title>Re: 'for' loops</title>
	<published>2008-12-01T16:52:05Z</published>
	<updated>2008-12-01T16:52:05Z</updated>
	<author>
		<name>Steve Willoughby</name>
	</author>
	<content type="html">On Mon, Dec 01, 2008 at 04:44:02PM -0800, WM. wrote:
&lt;br&gt;&amp;gt; I recently asked a question about 'for' loops, expecting them to be 
&lt;br&gt;&amp;gt; similar to 'for-next' loops. I have looked at several on-line tutors but 
&lt;br&gt;&amp;gt; &amp;nbsp;am still in the dark about what 'for' loops do.
&lt;br&gt;&amp;gt; Does anyone have a plain English about the use of 'for' loops?
&lt;br&gt;&amp;gt; Are 'while' loops the only way Python runs a sub-routine over &amp; over?
&lt;br&gt;&lt;br&gt;No, both 'while' and 'for' loops are for running a block of code
&lt;br&gt;(whether subroutine calls or whatever) over and over. &amp;nbsp;The difference
&lt;br&gt;between the two is that 'while' will continue repeating the block
&lt;br&gt;for however many iterations it takes until the condition is satisfied
&lt;br&gt;('while x is true, for some expression x'), a 'for' loop will run the
&lt;br&gt;block of code a set number of times ('once for each element of some
&lt;br&gt;set of values').
&lt;br&gt;&lt;br&gt;So if you want to execute 'print' for every line of a file, you
&lt;br&gt;would do this:
&lt;br&gt;&lt;br&gt;&amp;nbsp; for line in file:
&lt;br&gt;&amp;nbsp; &amp;nbsp; print line
&lt;br&gt;&lt;br&gt;If you wanted to double a value until it exceeded 100, you would
&lt;br&gt;use a while loop:
&lt;br&gt;&lt;br&gt;&amp;nbsp; while x &amp;lt;= 100:
&lt;br&gt;&amp;nbsp; &amp;nbsp; x *= 2
&lt;br&gt;&lt;br&gt;If you just want something executed a specific number of times,
&lt;br&gt;(like print &amp;quot;hello&amp;quot; 10 times), you can use a for loop:
&lt;br&gt;&lt;br&gt;&amp;nbsp; for i in range(10):
&lt;br&gt;&amp;nbsp; &amp;nbsp; print &amp;quot;hello&amp;quot;
&lt;br&gt;&lt;br&gt;This is, just like any 'for' loop, executing the block once per
&lt;br&gt;element of a list. &amp;nbsp;The list in this case is range(10) which is
&lt;br&gt;an expression that generates the list (0, 1, 2, ..., 9), so you
&lt;br&gt;get one run through the code for each of those.
&lt;br&gt;&lt;br&gt;Does that help?
&lt;br&gt;&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783965&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Steve Willoughby &amp;nbsp; &amp;nbsp;| &amp;nbsp;Using billion-dollar satellites
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783965&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;steve@...&lt;/a&gt; &amp;nbsp; | &amp;nbsp;to hunt for Tupperware.
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783965&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/%27for%27-loops-tp20783867p20783965.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20783867</id>
	<title>'for' loops</title>
	<published>2008-12-01T16:44:02Z</published>
	<updated>2008-12-01T16:44:02Z</updated>
	<author>
		<name>WM-15</name>
	</author>
	<content type="html">I recently asked a question about 'for' loops, expecting them to be 
&lt;br&gt;similar to 'for-next' loops. I have looked at several on-line tutors but 
&lt;br&gt;&amp;nbsp; am still in the dark about what 'for' loops do.
&lt;br&gt;Does anyone have a plain English about the use of 'for' loops?
&lt;br&gt;Are 'while' loops the only way Python runs a sub-routine over &amp; over?
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783867&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/%27for%27-loops-tp20783867p20783867.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20783661</id>
	<title>Re: Tutor Digest, Vol 58, Issue 2</title>
	<published>2008-12-01T16:23:31Z</published>
	<updated>2008-12-01T16:23:31Z</updated>
	<author>
		<name>W W-2</name>
	</author>
	<content type="html">On Mon, Dec 1, 2008 at 5:24 PM, Alan Gauld &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783661&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;alan.gauld@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&amp;lt;snip&amp;gt;Since the OP isn&amp;#39;t using the loop counter a simpler solution&lt;br&gt;
is simply&lt;br&gt;
&lt;br&gt;
for x in range(3):&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;but the OP was looping from 3 to 1, and that&amp;#39;s the easiest way I knew of.&lt;br&gt;&lt;br&gt;-Wayne&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783661&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Re%3A-Tutor-Digest%2C-Vol-58%2C-Issue-2-tp20779752p20783661.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20783197</id>
	<title>Re: converting processing code to python code</title>
	<published>2008-12-01T15:45:25Z</published>
	<updated>2008-12-01T15:45:25Z</updated>
	<author>
		<name>Steve Willoughby</name>
	</author>
	<content type="html">On Mon, Dec 01, 2008 at 06:40:03PM -0500, Erica Osher wrote:
&lt;br&gt;&amp;gt; The code was originally created for a Processing Project and I'm just
&lt;br&gt;&amp;gt; starting to learn python and I'd like to build on this code.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The syntax error I get is
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; *Traceback (most recent call last):
&lt;br&gt;&amp;gt; &amp;nbsp; File &amp;quot;nodebox/gui/mac/__init__.pyo&amp;quot;, line 332, in _compileScript
&lt;br&gt;&amp;gt; &amp;nbsp; File &amp;quot;&amp;lt;untitled&amp;gt;&amp;quot;, line 8
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;int x1 = 5;
&lt;br&gt;&lt;br&gt;That's not even close to Python syntax. &amp;nbsp;That looks 
&lt;br&gt;like a C-derived language. &amp;nbsp;I'd recommend going through
&lt;br&gt;a basic Python tutorial first, so you can see how Python
&lt;br&gt;works in a general sense before trying to convert code.
&lt;br&gt;&lt;br&gt;In Python, you don't need to declare variables like
&lt;br&gt;that, you just assign them values. &amp;nbsp;So that line would
&lt;br&gt;be simply:
&lt;br&gt;&lt;br&gt;&amp;nbsp; x1 = 5
&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; &amp;nbsp;SyntaxError: invalid syntax
&lt;br&gt;&amp;gt; *
&lt;br&gt;&amp;gt; any suggestions?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Thanks.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; On Mon, Dec 1, 2008 at 6:30 PM, Alan Gauld &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783197&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;alan.gauld@...&lt;/a&gt;&amp;gt;wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;quot;Erica Osher&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783197&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;eosher@...&lt;/a&gt;&amp;gt; wrote
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp;I have a simple processing code that I'm trying to work with in python,
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; but
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; I keep getting syntax errors. Any help on changing the code would be
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; greatly
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; appreciated. Thanks.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; It would help to have some background.
&lt;br&gt;&amp;gt; &amp;gt; What language are you translating from? It could be C/C++/JavaScript or
&lt;br&gt;&amp;gt; &amp;gt; Java.
&lt;br&gt;&amp;gt; &amp;gt; Or possibly other C type languages. It might be significant!
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Also show us what you tried and the syntax error messages.
&lt;br&gt;&amp;gt; &amp;gt; That way we can figure out what it is you are doing wrong.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Otherwise we wind up writing your code for you and you learn nothing.
&lt;br&gt;&amp;gt; &amp;gt; Then we have to do it all o er again next time you get stuck.
&lt;br&gt;&amp;gt; &amp;gt; That's inefficient for both you and us!
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; --
&lt;br&gt;&amp;gt; &amp;gt; Alan Gauld
&lt;br&gt;&amp;gt; &amp;gt; Author of the Learn to Program web site
&lt;br&gt;&amp;gt; &amp;gt; &lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; &amp;gt; Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783197&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &amp;gt; &lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; Erica Osher
&lt;/div&gt;&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783197&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Steve Willoughby &amp;nbsp; &amp;nbsp;| &amp;nbsp;Using billion-dollar satellites
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783197&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;steve@...&lt;/a&gt; &amp;nbsp; | &amp;nbsp;to hunt for Tupperware.
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783197&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/converting-processing-code-to-python-code-tp20780219p20783197.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20783118</id>
	<title>Re: converting processing code to python code</title>
	<published>2008-12-01T15:40:03Z</published>
	<updated>2008-12-01T15:40:03Z</updated>
	<author>
		<name>Erica Osher</name>
	</author>
	<content type="html">The code was originally created for a Processing Project and I&amp;#39;m just starting to learn python and I&amp;#39;d like to build on this code.&lt;br&gt;&lt;br&gt;The syntax error I get is&lt;br&gt;&lt;br&gt;&lt;b&gt;Traceback (most recent call last):&lt;br&gt;&amp;nbsp; File &amp;quot;nodebox/gui/mac/__init__.pyo&amp;quot;, line 332, in _compileScript&lt;br&gt;
&amp;nbsp; File &amp;quot;&amp;lt;untitled&amp;gt;&amp;quot;, line 8&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int x1 = 5;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^&lt;br&gt;&amp;nbsp;SyntaxError: invalid syntax&lt;br&gt;&lt;/b&gt;&lt;br&gt;any suggestions?&lt;br&gt;&lt;br&gt;Thanks.&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Mon, Dec 1, 2008 at 6:30 PM, Alan Gauld &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783118&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;alan.gauld@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;br&gt;
&amp;quot;Erica Osher&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783118&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;eosher@...&lt;/a&gt;&amp;gt; wrote&lt;div class=&quot;Ih2E3d&quot;&gt;&lt;br&gt;
&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
I have a simple processing code that I&amp;#39;m trying to work with in python, but&lt;br&gt;
I keep getting syntax errors. Any help on changing the code would be greatly&lt;br&gt;
appreciated. Thanks.&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;&lt;/div&gt;
It would help to have some background.&lt;br&gt;
What language are you translating from? It could be C/C++/JavaScript or Java.&lt;br&gt;
Or possibly other C type languages. It might be significant!&lt;br&gt;
&lt;br&gt;
Also show us what you tried and the syntax error messages.&lt;br&gt;
That way we can figure out what it is you are doing wrong.&lt;br&gt;
&lt;br&gt;
Otherwise we wind up writing your code for you and you learn nothing.&lt;br&gt;
Then we have to do it all o er again next time you get stuck.&lt;br&gt;
That&amp;#39;s inefficient for both you and us!&lt;br&gt;&lt;font color=&quot;#888888&quot;&gt;
&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Alan Gauld&lt;br&gt;
Author of the Learn to Program web site&lt;br&gt;
&lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt; &lt;br&gt;
&lt;br&gt;
_______________________________________________&lt;br&gt;
Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783118&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Erica Osher&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783118&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/converting-processing-code-to-python-code-tp20780219p20783118.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20783005</id>
	<title>Re: converting processing code to python code</title>
	<published>2008-12-01T15:30:20Z</published>
	<updated>2008-12-01T15:30:20Z</updated>
	<author>
		<name>Alan Gauld</name>
	</author>
	<content type="html">&lt;br&gt;&amp;quot;Erica Osher&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783005&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;eosher@...&lt;/a&gt;&amp;gt; wrote
&lt;br&gt;&lt;br&gt;&amp;gt;I have a simple processing code that I'm trying to work with in 
&lt;br&gt;&amp;gt;python, but
&lt;br&gt;&amp;gt; I keep getting syntax errors. Any help on changing the code would be 
&lt;br&gt;&amp;gt; greatly
&lt;br&gt;&amp;gt; appreciated. Thanks.
&lt;br&gt;&lt;br&gt;It would help to have some background.
&lt;br&gt;What language are you translating from? It could be C/C++/JavaScript 
&lt;br&gt;or Java.
&lt;br&gt;Or possibly other C type languages. It might be significant!
&lt;br&gt;&lt;br&gt;Also show us what you tried and the syntax error messages.
&lt;br&gt;That way we can figure out what it is you are doing wrong.
&lt;br&gt;&lt;br&gt;Otherwise we wind up writing your code for you and you learn nothing.
&lt;br&gt;Then we have to do it all o er again next time you get stuck.
&lt;br&gt;That's inefficient for both you and us!
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Alan Gauld
&lt;br&gt;Author of the Learn to Program web site
&lt;br&gt;&lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20783005&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/converting-processing-code-to-python-code-tp20780219p20783005.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20782930</id>
	<title>Re: Tutor Digest, Vol 58, Issue 2</title>
	<published>2008-12-01T15:24:38Z</published>
	<updated>2008-12-01T15:24:38Z</updated>
	<author>
		<name>Alan Gauld</name>
	</author>
	<content type="html">&lt;br&gt;&amp;quot;W W&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20782930&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;srilyk@...&lt;/a&gt;&amp;gt; wrote
&lt;br&gt;&lt;br&gt;&amp;gt; for x in xrange(3, 0, -1):
&lt;br&gt;&amp;gt; &amp;nbsp; ....: &amp;nbsp; &amp;nbsp; print x
&lt;br&gt;&amp;gt; &amp;nbsp; ....:
&lt;br&gt;&amp;gt; &amp;nbsp; ....:
&lt;br&gt;&amp;gt; 3
&lt;br&gt;&amp;gt; 2
&lt;br&gt;&amp;gt; 1
&lt;br&gt;&lt;br&gt;Since the OP isn't using the loop counter a simpler solution
&lt;br&gt;is simply
&lt;br&gt;&lt;br&gt;for x in range(3):
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&amp;gt; i,j,k = 3,3,3
&lt;br&gt;&amp;gt;&amp;gt; while i != 1:
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;print 'Larry, Moe &amp; Curly Joe!'
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;i -= 1
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;while j != 1:
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;print 'Go Mad!!'
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;j -= 1
&lt;br&gt;&amp;gt;&amp;gt; while k != 1:
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;print 'Go-go bad-bad!!'
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;k -= 1
&lt;br&gt;&amp;gt;&amp;gt; print '\nBye-bye.'
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I am trying to learn loops. &amp;nbsp;These nested 'whiles' work OK but I 
&lt;br&gt;&amp;gt;&amp;gt; would like
&lt;br&gt;&amp;gt;&amp;gt; to wrap this script in a 'for' loop. I have not been able to make 
&lt;br&gt;&amp;gt;&amp;gt; that work.
&lt;/div&gt;&lt;br&gt;To the OP:
&lt;br&gt;It helps if you show us what you tried so that we can see where
&lt;br&gt;the misunderstanding is. What did you do and what happened?
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Alan Gauld
&lt;br&gt;Author of the Learn to Program web site
&lt;br&gt;&lt;a href=&quot;http://www.freenetpages.co.uk/hp/alan.gauld&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.freenetpages.co.uk/hp/alan.gauld&lt;/a&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20782930&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Re%3A-Tutor-Digest%2C-Vol-58%2C-Issue-2-tp20779752p20782930.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20780461</id>
	<title>Re: converting processing code to python code</title>
	<published>2008-12-01T13:02:02Z</published>
	<updated>2008-12-01T13:02:02Z</updated>
	<author>
		<name>Steve Willoughby</name>
	</author>
	<content type="html">On Mon, Dec 01, 2008 at 12:59:23PM -0800, Steve Willoughby wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; &amp;gt; void drawSquare1() {
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp;if(x1&amp;lt;0 || x1&amp;gt;width-size) {
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp; x1Speed = -x1Speed;
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp;}
&lt;br&gt;&amp;gt; &amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp;if(y1&amp;lt;0 || y1&amp;gt;height-size) {
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp; y1Speed = -y1Speed;
&lt;br&gt;&amp;gt; &amp;gt; &amp;nbsp;}
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; def drawSquare1():
&lt;br&gt;&amp;gt; &amp;nbsp; if (x1 &amp;lt; 0 or x1 &amp;gt; width-size):
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; x1 += x1Speed
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; y1 += y1Speed
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; rect(x1, y1, size, size)
&lt;/div&gt;&lt;br&gt;I think my eyes skipped somewhere while copying that
&lt;br&gt;over. &amp;nbsp;The exact translation of that code snippet would
&lt;br&gt;of course have been:
&lt;br&gt;&lt;br&gt;def drawSquare1():
&lt;br&gt;&amp;nbsp; if x1 &amp;lt; 0 or x1 &amp;gt; width-size:
&lt;br&gt;&amp;nbsp; &amp;nbsp; x1Speed = -x1Speed
&lt;br&gt;&amp;nbsp; if y1 &amp;lt; 0 or y1 &amp;gt; height-size:
&lt;br&gt;&amp;nbsp; &amp;nbsp; y1Speed = -y1Speed
&lt;br&gt;&lt;br&gt;Sorry 'bout that.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Steve Willoughby &amp;nbsp; &amp;nbsp;| &amp;nbsp;Using billion-dollar satellites
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20780461&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;steve@...&lt;/a&gt; &amp;nbsp; | &amp;nbsp;to hunt for Tupperware.
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20780461&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/converting-processing-code-to-python-code-tp20780219p20780461.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20780409</id>
	<title>Re: converting processing code to python code</title>
	<published>2008-12-01T12:59:23Z</published>
	<updated>2008-12-01T12:59:23Z</updated>
	<author>
		<name>Steve Willoughby</name>
	</author>
	<content type="html">On Mon, Dec 01, 2008 at 03:48:59PM -0500, Erica Osher wrote:
&lt;br&gt;&amp;gt; I have a simple processing code that I'm trying to work with in python, but
&lt;br&gt;&amp;gt; I keep getting syntax errors. Any help on changing the code would be greatly
&lt;br&gt;&amp;gt; appreciated. Thanks.
&lt;br&gt;&lt;br&gt;Could you show us what you have so far in Python and what syntax errors
&lt;br&gt;you get?
&lt;br&gt;&lt;br&gt;Just as one example, this would be
&lt;br&gt;pretty straightforward to convert straight
&lt;br&gt;to Python, syntactically. &amp;nbsp;Whether you'd 
&lt;br&gt;want to restructure the application to be
&lt;br&gt;more optimally &amp;quot;Pythonic&amp;quot; is another topic
&lt;br&gt;depending on what else is going on (or is 
&lt;br&gt;this the entire program)?
&lt;br&gt;&lt;br&gt;&amp;gt; void drawSquare1() {
&lt;br&gt;&amp;gt; &amp;nbsp;if(x1&amp;lt;0 || x1&amp;gt;width-size) {
&lt;br&gt;&amp;gt; &amp;nbsp; x1Speed = -x1Speed;
&lt;br&gt;&amp;gt; &amp;nbsp;}
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp;if(y1&amp;lt;0 || y1&amp;gt;height-size) {
&lt;br&gt;&amp;gt; &amp;nbsp; y1Speed = -y1Speed;
&lt;br&gt;&amp;gt; &amp;nbsp;}
&lt;br&gt;&lt;br&gt;def drawSquare1():
&lt;br&gt;&amp;nbsp; if (x1 &amp;lt; 0 or x1 &amp;gt; width-size):
&lt;br&gt;&amp;nbsp; &amp;nbsp; x1 += x1Speed
&lt;br&gt;&amp;nbsp; &amp;nbsp; y1 += y1Speed
&lt;br&gt;&amp;nbsp; &amp;nbsp; rect(x1, y1, size, size)
&lt;br&gt;&lt;br&gt;Is that the sort of code you're coming up with?
&lt;br&gt;&lt;br&gt;One thing that strikes me off the top here is that
&lt;br&gt;(in either language) you'd be better off not using
&lt;br&gt;all those global variables. &amp;nbsp;Make your functions take
&lt;br&gt;parameters and use them in your calculations.
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Steve Willoughby &amp;nbsp; &amp;nbsp;| &amp;nbsp;Using billion-dollar satellites
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20780409&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;steve@...&lt;/a&gt; &amp;nbsp; | &amp;nbsp;to hunt for Tupperware.
&lt;br&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20780409&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/converting-processing-code-to-python-code-tp20780219p20780409.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20780219</id>
	<title>converting processing code to python code</title>
	<published>2008-12-01T12:48:59Z</published>
	<updated>2008-12-01T12:48:59Z</updated>
	<author>
		<name>Erica Osher</name>
	</author>
	<content type="html">I have a simple processing code that I&amp;#39;m trying to work with in python, but I keep getting syntax errors. Any help on changing the code would be greatly appreciated. Thanks. &lt;br&gt;&lt;br&gt;void setup() {&lt;br&gt;&amp;nbsp;size(550, 500);&lt;br&gt;
&amp;nbsp;noStroke();&lt;br&gt;&amp;nbsp;smooth();&lt;br&gt;&amp;nbsp;fill(255, 255, 255, 150);&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;//Square 1 vars&lt;br&gt;int x1 = 5;&lt;br&gt;int y1 = 10;&lt;br&gt;&lt;br&gt;int x1Speed = 2;&lt;br&gt;int y1Speed = 2;&lt;br&gt;&lt;br&gt;//Square 2 Vars&lt;br&gt;int x2 = 150;&lt;br&gt;int y2 = 100;&lt;br&gt;
&lt;br&gt;int x2Speed = 4;&lt;br&gt;int y2Speed = 4;&lt;br&gt;&lt;br&gt;int size = 100;&lt;br&gt;&lt;br&gt;void draw() {&lt;br&gt;&amp;nbsp;background(180, 0, 0);&lt;br&gt;&amp;nbsp;drawSquare1();&lt;br&gt;&amp;nbsp;drawSquare2();&lt;br&gt;&amp;nbsp;&lt;br&gt;&amp;nbsp;checkCollision();&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;void drawSquare1() {&lt;br&gt;
&amp;nbsp;if(x1&amp;lt;0 || x1&amp;gt;width-size) {&lt;br&gt;&amp;nbsp; x1Speed = -x1Speed; &lt;br&gt;&amp;nbsp;}&lt;br&gt;&amp;nbsp;&lt;br&gt;&amp;nbsp;if(y1&amp;lt;0 || y1&amp;gt;height-size) {&lt;br&gt;&amp;nbsp; y1Speed = -y1Speed;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;}&lt;br&gt;&amp;nbsp;&lt;br&gt;&amp;nbsp;x1+= x1Speed;&lt;br&gt;&amp;nbsp;y1+= y1Speed;&lt;br&gt;&amp;nbsp;rect(x1, y1, size, size); &lt;br&gt;}&lt;br&gt;
&lt;br&gt;void drawSquare2() {&lt;br&gt;&amp;nbsp;if(x2&amp;lt;0 || x2&amp;gt;width-size) {&lt;br&gt;&amp;nbsp; x2Speed = -x2Speed; &lt;br&gt;&amp;nbsp;}&lt;br&gt;&amp;nbsp;&lt;br&gt;&amp;nbsp;if(y2&amp;lt;0 || y2&amp;gt;height-size) {&lt;br&gt;&amp;nbsp; y2Speed = -y2Speed;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;}&lt;br&gt;&amp;nbsp;&lt;br&gt;&amp;nbsp;x2+= x2Speed;&lt;br&gt;&amp;nbsp;y2+= y2Speed;&lt;br&gt;&amp;nbsp;rect(x2, y2, size, size); &lt;br&gt;
}&lt;br&gt;&lt;br&gt;void checkCollision() {&lt;br&gt;&amp;nbsp;if(abs(x1-x2) &amp;lt; size &amp;amp;&amp;amp; abs(y1-y2) &amp;lt; size) {&lt;br&gt;&amp;nbsp; println(&amp;quot;Collision&amp;quot;);&lt;br&gt;&amp;nbsp; //fill(255, 255, 255, 200);&lt;br&gt;&amp;nbsp; x1Speed=-x1Speed;&lt;br&gt;&amp;nbsp; x2Speed=-x2Speed;&lt;br&gt;&amp;nbsp; &lt;br&gt;
&amp;nbsp; y1Speed=-y1Speed;&lt;br&gt;&amp;nbsp; y2Speed=-y2Speed;&lt;br&gt;&amp;nbsp;} else {&lt;br&gt;&amp;nbsp; fill(255, 255, 255, 100); &lt;br&gt;&amp;nbsp;}; &lt;br&gt;}&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Erica Osher&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20780219&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/converting-processing-code-to-python-code-tp20780219p20780219.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-20780043</id>
	<title>Re: Tutor Digest, Vol 58, Issue 2</title>
	<published>2008-12-01T12:38:28Z</published>
	<updated>2008-12-01T12:38:28Z</updated>
	<author>
		<name>W W-2</name>
	</author>
	<content type="html">Try this:&lt;br&gt;&lt;br&gt;&amp;nbsp;for x in xrange(3, 0, -1):&lt;br&gt;&amp;nbsp;&amp;nbsp; ....:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print x&lt;br&gt;&amp;nbsp;&amp;nbsp; ....:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp; ....:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;3&lt;br&gt;2&lt;br&gt;1&lt;br&gt;&lt;br&gt;HTH,&lt;br&gt;Wayne&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Mon, Dec 1, 2008 at 2:20 PM, WM. &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20780043&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wferguson1@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;Stooges.py&lt;br&gt;
&lt;br&gt;
i,j,k = 3,3,3&lt;br&gt;
while i != 1:&lt;br&gt;
 &amp;nbsp; &amp;nbsp;print &amp;#39;Larry, Moe &amp;amp; Curly Joe!&amp;#39;&lt;br&gt;
 &amp;nbsp; &amp;nbsp;i -= 1&lt;br&gt;
 &amp;nbsp; &amp;nbsp;while j != 1:&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;print &amp;#39;Go Mad!!&amp;#39;&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;j -= 1&lt;br&gt;
while k != 1:&lt;br&gt;
 &amp;nbsp; &amp;nbsp;print &amp;#39;Go-go bad-bad!!&amp;#39;&lt;br&gt;
 &amp;nbsp; &amp;nbsp;k -= 1&lt;br&gt;
print &amp;#39;\nBye-bye.&amp;#39;&lt;br&gt;
&lt;br&gt;
I am trying to learn loops. &amp;nbsp;These nested &amp;#39;whiles&amp;#39; work OK but I would like to wrap this script in a &amp;#39;for&amp;#39; loop. I have not been able to make that work.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
_______________________________________________&lt;br&gt;
Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20780043&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;To be considered stupid and to be told so is more painful than being called gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness, every vice, has found its defenders, its rhetoric, its ennoblement and exaltation, but stupidity hasn't. - Primo Levi&lt;br&gt;

&lt;br /&gt;_______________________________________________
&lt;br&gt;Tutor maillist &amp;nbsp;- &amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=20780043&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Tutor@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mail.python.org/mailman/listinfo/tutor&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mail.python.org/mailman/listinfo/tutor&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Re%3A-Tutor-Digest%2C-Vol-58%2C-Issue-2-tp20779752p20780043.html" />
</entry>

</feed>
