Re: [Tutor] namespaces

2010-05-30 Thread Matthew Wood
gt; Från: Evert Rol [mailto:evert@gmail.com] > Skickat: den 30 maj 2010 18:34 > Till: Robert Johansson > Kopia: tutor@python.org > Ämne: Re: [Tutor] namespaces > > Hi Robert > > > This code generates the message "UnboundLocalError: local variable >

Re: [Tutor] namespaces

2010-05-30 Thread Robert Johansson
Thanks Evert for pointing out the difference and the discussion on global variables, it helped. /Robert -Ursprungligt meddelande- Från: Evert Rol [mailto:evert@gmail.com] Skickat: den 30 maj 2010 18:34 Till: Robert Johansson Kopia: tutor@python.org Ämne: Re: [Tutor] namespaces

Re: [Tutor] namespaces

2010-05-30 Thread Evert Rol
Hi Robert > This code generates the message “UnboundLocalError: local variable 'doubles' > referenced before assignment” (line: if d[0] == d[1] and doubles == 2:) > > http://pastebin.com/mYBaCfj1 > > I think I have a fair picture of what it means but I would be very happy if > someone co

[Tutor] namespaces

2010-05-30 Thread Robert Johansson
Hi, This code generates the message "UnboundLocalError: local variable 'doubles' referenced before assignment" (line: if d[0] == d[1] and doubles == 2:) http://pastebin.com/mYBaCfj1 I think I have a fair picture of what it means but I would be very happy if someone could explain the d

Re: [Tutor] namespaces and global

2009-10-15 Thread Dave Angel
Jose Amoreira wrote: Alan, Kent, hello! Thanks for your help. As for your "curiosity", I'm teaching elementary physics to undergraduates in computer engineering. Trying to speak my students' language, I wanted to show them simple applications that compute numerical values for the kinematics fo

Re: [Tutor] namespaces and global

2009-10-14 Thread Jose Amoreira
Alan, Kent, hello! Thanks for your help. As for your "curiosity", I'm teaching elementary physics to undergraduates in computer engineering. Trying to speak my students' language, I wanted to show them simple applications that compute numerical values for the kinematics formulas of uniformly acc

Re: [Tutor] namespaces and global

2009-10-14 Thread Alan Gauld
"Jose Amoreira" wrote Of course I could redefine my module function, including the parameter a in the list of arguments, but I'd rather not. Why not? That would be good computer science practice and the most reliable way to do it. Why do you not want to go down that route? Is there a specif

Re: [Tutor] namespaces and global

2009-10-14 Thread Kent Johnson
On Wed, Oct 14, 2009 at 7:26 AM, Jose Amoreira wrote: > I want to use a variable defined in an interactive session with the python > interpreter inside a function imported from a module. > > For instance, imagine that my module (call it defs.py, for instance) consists > of: > #coding=utf-8 > def

[Tutor] namespaces and global

2009-10-14 Thread Jose Amoreira
Hello I'm new to this list. I tried to find the answer to my question but found nothing I could really use. I'm sorry if this is a FAQ. I want to use a variable defined in an interactive session with the python interpreter inside a function imported from a module. For instance, imagine that my

Re: [Tutor] namespaces and the __dict__ function?

2008-01-25 Thread Kent Johnson
John Gunderman wrote: > I am new to python and have found both the concept of namespaces and the > __dict__ function to be rather confusing, and I cant find any good > explanations on the web. Could any of you give me a good explanation of > these? And for __dict__, is is the same thing as __str

[Tutor] namespaces and the __dict__ function?

2008-01-25 Thread John Gunderman
I am new to python and have found both the concept of namespaces and the __dict__ function to be rather confusing, and I cant find any good explanations on the web. Could any of you give me a good explanation of these? And for __dict__, is is the same thing as __str__ except in string form, or d