Re: [Tutor] When are strings interned?

2009-07-01 Thread wesley chun
n = "colourless" o = "colourless" n == o > True n is o > True p = "green ideas" q = "green ideas" p == q > True p is q > False > > Why the difference? angus, welcome to Python! you're definitely doing your homework when it comes to trying to understand how

Re: [Tutor] Python Programming exercise

2009-07-01 Thread Alan Gauld
"Daniel Sato" wrote I have been able to make the module quit after entering a password three times, but can't get it to quit right away after the correct one is password = "qwerty" guess = "0" count = 0 while count != 3: guess = raw_input("Enter your password: ") guess = str

Re: [Tutor] calculating a sort key and operator.attrgetter()

2009-07-01 Thread Vincent Davis
Thanks for the help, Looks like I will define a function. And yes you are right self.does_observe is constant so it will not affect the outcome. Thanks again Vincent Davis On Tue, Jun 30, 2009 at 11:15 PM, Kent Johnson wrote: > On Tue, Jun 30, 2009 at 11:39 PM, Vincent Davis > wrote: > > I ha

Re: [Tutor] Python Programming exercise

2009-07-01 Thread Sander Sweers
2009/7/1 Daniel Sato : > I have been going through some Python Programming exercises while following > the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with > the first "If" exercise listed on this page: > > http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statement

Re: [Tutor] When are strings interned?

2009-07-01 Thread Marc Tompkins
On Wed, Jul 1, 2009 at 5:29 PM, Robert Berman wrote: > > >>> n = "colourless" > > >>> o = "colourless" > > >>> n == o > > True > > >>> n is o > > True > > >>> p = "green ideas" > > >>> q = "green ideas" > > >>> p == q > > True > > >>> p is q > > False > > > > Why the difference? > > The string p

Re: [Tutor] Python Programming exercise

2009-07-01 Thread Craig McDonald
On Wed, Jul 1, 2009 at 3:53 AM, Daniel Sato wrote: > I have been going through some Python Programming exercises while following > the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with > the first "If" exercise listed on this page: > > http://en.wikibooks.org/wiki/Python_Progr

Re: [Tutor] Python Programming exercise

2009-07-01 Thread Dave Angel
Daniel Sato wrote: I have been going through some Python Programming exercises while following the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with the first "If" exercise listed on this page: http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements#If_Ex

Re: [Tutor] Python Programming exercise

2009-07-01 Thread Christian Witts
Daniel Sato wrote: I have been going through some Python Programming exercises while following the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with the first "If" exercise listed on this page: http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements#If_Exer

Re: [Tutor] When are strings interned?

2009-07-01 Thread Robert Berman
On Wed, 2009-07-01 at 16:44 +0100, Angus Rodgers wrote: > Hello, world! > > This is my first post to the Tutor list (although I've already > posted to comp.lang.python a couple of times). > > I'm currently reading Chapter 4 of Wesley Chun's book, "Core > Python Programming" (2nd ed.). > > I f

Re: [Tutor] Python Programming exercise

2009-07-01 Thread bob gailer
Daniel Sato wrote: I have been going through some Python Programming exercises while following the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with the first "If" exercise listed on this page: http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements#If_Exer

Re: [Tutor] Python Programming exercise

2009-07-01 Thread Robert Berman
1. Pay more attention to what ends an if statement (:) also watch your indentation. 2. Code is better than my commentary. This works the way you want it to work. password = "qwerty" guess = "0" count = 0 while count != 3: guess = raw_input("Enter your password: ") guess = str(gu

Re: [Tutor] egg

2009-07-01 Thread Pete Froslie
responding to myself: apparently it seems to be as simple again as: 'easy_install simplejson' from terminal. Anyone, have a suggestion for a resource where I can read more about the paths I have setup? I would like to make sure there are not any redundancies.. thanks On Wed, Jul 1, 2009 at 4:47

[Tutor] egg

2009-07-01 Thread Pete Froslie
Hi, I have a basic question concerning pythons eggs. I have setup easy install and used it to install mechanize-- this was easy as I only needed to type in 'Easy_Install Mechanize' in terminal. Now I need to install 'simplejson 2.0.9' from this here: http://pypi.python.org/pypi/simplejson Can anyo

Re: [Tutor] Python Programming exercise

2009-07-01 Thread Wayne
On Tue, Jun 30, 2009 at 9:53 PM, Daniel Sato wrote: > I have been able to make the module quit after entering a password three > times, but can't get it to quit right away after the correct one is > entered. I know this is really basic, please forgive me. I have no > programming experience an

[Tutor] Fwd: calculating a sort key and operator.attrgetter()

2009-07-01 Thread Rich Lovely
Forgot to reply-all... -- Forwarded message -- From: Rich Lovely Date: 2009/7/1 Subject: Re: [Tutor] calculating a sort key and operator.attrgetter() To: Vincent Davis 2009/7/1 Vincent Davis : > I have a class with an attribute which is a list "rank_list" this is a list > of i

Re: [Tutor] calculating a sort key and operator.attrgetter()

2009-07-01 Thread Kent Johnson
On Tue, Jun 30, 2009 at 11:39 PM, Vincent Davis wrote: > I have a class with an attribute which is a list "rank_list" this is a list > of instances f another class that has attributes "quality, is_observed" > if I want to sort the list by the attribute "quality" I can just use, > self.rank_list.sor

Re: [Tutor] Python Programming exercise

2009-07-01 Thread Michiel Overtoom
Daniel Sato wrote: am having some trouble with the first "If" Don't forget the colon at the end of the line. if condition: pass Greetings, -- "The ability of the OSS process to collect and harness the collective IQ of thousands of individuals across the Internet is

[Tutor] When are strings interned?

2009-07-01 Thread Angus Rodgers
Hello, world! This is my first post to the Tutor list (although I've already posted to comp.lang.python a couple of times). I'm currently reading Chapter 4 of Wesley Chun's book, "Core Python Programming" (2nd ed.). I find this, in Python 2.5.4, on my Win98SE system (using IDLE): >>> n = "colo

Re: [Tutor] Python Programming exercise

2009-07-01 Thread Emile van Sebille
On 6/30/2009 7:53 PM Daniel Sato said... I have been able to make the module quit after entering a password three times, but can't get it to quit right away after the correct one is entered. I know this is really basic, please forgive me. I have no programming experience and have just started

Re: [Tutor] Python Programming exercise

2009-07-01 Thread Siim Märtmaa
2009/7/1 Daniel Sato : > I have been going through some Python Programming exercises while following > the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with > the first "If" exercise listed on this page: > > http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statement

Re: [Tutor] PYTHONPATH-corrected

2009-07-01 Thread Alan Gauld
"Steve Willoughby" wrote in directories for chapers. Now I am on modules, and some are reused in later chapters. I have set up a directory for the modules. How do I add it to my PYTHONPATH? So, for example, in a bash/sh shell, you'd say: export PYTHONPATH="/path/to/my/modules" And you ca