global/local variables

2008-01-24 Thread Tim Rau
What makes python decide whether a particular variable is global or local? I've got a list and a integer, both defined at top level, no indentation, right next to each other: allThings = [] nextID = 0 and yet, in the middle of a function, python sees one and doesn't see the other: class ship(thi

Re: global/local variables

2008-01-24 Thread Tim Rau
On Jan 24, 7:09 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 24 Jan 2008 15:37:09 -0800, Tim Rau wrote: > > What makes python decide whether a particular variable > > is global or local? > > For starters, if the line of code is not

Re: global/local variables

2008-01-25 Thread Tim Rau
On Jan 25, 5:31 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 24 Jan 2008 23:04:42 -0800, Tim Rau wrote: > > UnboundLocalError: local variable 'nextID' referenced before assignment > > When you assign to a name in Python, the comp

Re: global/local variables

2008-01-25 Thread Tim Rau
On Jan 25, 5:31 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 24 Jan 2008 23:04:42 -0800, Tim Rau wrote: > > UnboundLocalError: local variable 'nextID' referenced before assignment > > When you assign to a name in Python, the comp

Re: Puzzled by behaviour of class with empty constructor

2008-01-25 Thread Tim Rau
On Jan 25, 5:54 pm, [EMAIL PROTECTED] wrote: > On Jan 25, 5:46 pm, Bjoern Schliessmann > > > [EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > > print x.ends,y.ends,z.ends > > > # > > > Running the following code outputs: > > [(0, 2)] [(0, 2)] [(0, 2)] > > > > Can anyone

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread Tim Rau
On Jan 25, 10:25 pm, [EMAIL PROTECTED] wrote: > > I agree that SDL is probably the best choice but for the sake of > > completeness, Gtk can (at least in theory - I've never tried it) be > > built against directfb and run without X. > > from the Pygame Introduction: Pygame is a Python extension lib

Doesn't know what it wants

2008-01-25 Thread Tim Rau
Traceback (most recent call last): File "C:\Documents and Settings\Owner\My Documents\NIm's code\sandbox \sandbox.py", line 242, in player = ship() File "C:\Documents and Settings\Owner\My Documents\NIm's code\sandbox \sandbox.py", line 121, in __init__ self.phyInit() File "C:\Docume

Re: Doesn't know what it wants

2008-01-25 Thread Tim Rau
On Jan 26, 1:41 am, John Machin <[EMAIL PROTECTED]> wrote: > On Jan 26, 4:20 pm, Tim Rau <[EMAIL PROTECTED]> wrote: > > > > > Traceback (most recent call last): > > File "C:\Documents and Settings\Owner\My Documents\NIm's code\sandbox > &g

Re: Doesn't know what it wants

2008-01-25 Thread Tim Rau
On Jan 26, 1:32 am, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080126 06:26], Tim Rau ([EMAIL PROTECTED]) wrote: > > >Line 147 reads: > >moi = cp.cpMomentForCircle(self.mass, .2, 0, vec2d((0,0))) > > I think it expects som

Re: How can I use the up and down, left and right arrow keys to control a Python Pgm

2008-01-25 Thread Tim Rau
On Jan 25, 10:48 pm, "jitrowia" <[EMAIL PROTECTED]> wrote: > I was wondering what kind of python code I would need to enable me to > use the up and down, left and right arrow keys to control software > programming decisions within a Python Program. > > Any direction and advice would be greatly appr

Re: Doesn't know what it wants

2008-01-26 Thread Tim Rau
Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] > > > nomine.org> wrote: > > >> -On [20080126 06:26], Tim Rau ([EMAIL PROTECTED]) wrote: > > > >> >Line 147 reads: > > >> >moi = cp.cpMomentForCircle(self.mass, .2, 0, vec2d((0,0))) > > &g

Executing other python code

2008-01-28 Thread Tim Rau
I'm working on a game, and I'd like players to be able to define thier ships with scripts. Naturally, I don't want to give them the entire program as thier romping ground. I would like to invoke a seperate interpreter for these files, and give it a limited subset of the functions in my game. What i