RE: Python: A Program I'd Love To Understand
- From: "Homme, James" <james.homme@xxxxxxxxxxxx>
- To: "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
- Date: Wed, 22 Jun 2011 15:48:59 -0400
Hi Richard,
I put the quotes in to see if Python would complain and it did. I wanted to see
if I could understand the error message, and it made sense to me.
Thanks.
Jim
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of R Dinger
Sent: Wednesday, June 22, 2011 3:46 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: Python: A Program I'd Love To Understand
Hi Jim,
Is this a new thread? Did you put quotes around one of your target values? If
so, then that value is no longer callable in the current program (the runner
function), look at your stack trace for hints as to where it is blowing up.
If you are just tinkering around in the interpreter with a dictionary, I'm not
clear on what is going on.
Using the interpreter is a great resource. Be sure to use help(item) to get
details on calling and so on. Note you can get help on data structure
functions like the dict 'keys' function by entering:
>>> help({}.keys)
Richard
----- Original Message -----
From: Homme, James<mailto:james.homme@xxxxxxxxxxxx>
To: programmingblind@xxxxxxxxxxxxx<mailto:programmingblind@xxxxxxxxxxxxx>
Sent: Wednesday, June 22, 2011 12:01 PM
Subject: RE: Python: A Program I'd Love To Understand
Hi Richard,
I am starting to be less timid about trying things out from the interpreter
command prompt. I just changed my program and put single quotes around one of
the dictionary values, and Python complained that the object wasn't callable.
Jim
From:
programmingblind-bounce@xxxxxxxxxxxxx<mailto:programmingblind-bounce@xxxxxxxxxxxxx>
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of R Dinger
Sent: Wednesday, June 22, 2011 2:17 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: Python: A Program I'd Love To Understand
Jim,
Your dictionary entries are all of the form:
'key': target
Your keys must be immutable like a string, tuple, number and so forth.
Your target can be almost anything like a string, tuple, list, function and so
forth. Since your targets are not quoted, they are not strings. In addition
each target, like death, must have been defined previously in your current
module or some module you have already imported.
HTH
Richard
The ----- Original Message -----
From: Homme, James<mailto:james.homme@xxxxxxxxxxxx>
To: programmingblind@xxxxxxxxxxxxx<mailto:programmingblind@xxxxxxxxxxxxx>
Sent: Wednesday, June 22, 2011 10:59 AM
Subject: Python: A Program I'd Love To Understand
Hi,
I have lots of questions about the current Python exercise I'm working on, so
I'll just ask one at a time. Hope you have lots of patience.
First question. I think I should be getting a compiler error but I'm not. I
thought I had to put some sort of quotes around this code after the commas. Why
is this compiling OK?
ROOMS = { 'death': death,
'princess_lives_here': princess_lives_here,
'gold_koi_pond': gold_koi_pond,
'big_iron_gate': big_iron_gate,
'bear_with_sword': bear_with_sword
}
Thanks.
Jim
Jim Homme,
Usability Services,
Phone: 412-544-1810.
________________________________
This e-mail and any attachments to it are confidential and are intended solely
for use of the individual or entity to whom they are addressed. If you have
received this e-mail in error, please notify the sender immediately and then
delete it. If you are not the intended recipient, you must not keep, use,
disclose, copy or distribute this e-mail without the author's prior permission.
The views expressed in this e-mail message do not necessarily represent the
views of Highmark Inc., its subsidiaries, or affiliates.
Other related posts:
- » Python: A Program I'd Love To Understand - Homme, James
- » Re: Python: A Program I'd Love To Understand - Littlefield, Tyler
- » Re: Python: A Program I'd Love To Understand - Q
- » Re: Python: A Program I'd Love To Understand - R Dinger
- » RE: Python: A Program I'd Love To Understand - Homme, James
- » RE: Python: A Program I'd Love To Understand - Homme, James
- » RE: Python: A Program I'd Love To Understand - Homme, James
- » Re: Python: A Program I'd Love To Understand - Q
- » RE: Python: A Program I'd Love To Understand - Homme, James
- » RE: Python: A Program I'd Love To Understand - Homme, James
- » Re: Python: A Program I'd Love To Understand - R Dinger
- » RE: Python: A Program I'd Love To Understand - Homme, James
- » RE: Python: A Program I'd Love To Understand - Rasmussen, Lloyd
- » Re: Python: A Program I'd Love To Understand - R Dinger
- » RE: Python: A Program I'd Love To Understand - Homme, James
- » Re: Python: A Program I'd Love To Understand - R Dinger
- » Re: Python: A Program I'd Love To Understand - Littlefield, Tyler
- » RE: Python: A Program I'd Love To Understand - Homme, James
- » Re: Python: A Program I'd Love To Understand - Littlefield, Tyler
- » RE: Python: A Program I'd Love To Understand - Homme, James