Re: variable question

2008-07-12 Thread Peter Otten
happy wrote: > I think its better to leave the "teach kiddies" tutoring opportunity > for the python experts out there. If you know how to make some simple scripts that do something that kids find interesting and are able to convey your enthusiasm, you are better suited to teach than any expert w

Re: variable question

2008-07-12 Thread happy
On Jul 12, 8:05 am, Robert Lehmann <[EMAIL PROTECTED]> wrote: > On Fri, 11 Jul 2008 20:13:04 -0700, happy wrote: > > Can a variable be considered the simplest of the data structures. I am > > tutoring some kids about basics of programming using python. Not an > > expert in computer sciences, but am

Re: variable question

2008-07-11 Thread Robert Lehmann
On Fri, 11 Jul 2008 20:13:04 -0700, happy wrote: > Can a variable be considered the simplest of the data structures. I am > tutoring some kids about basics of programming using python. Not an > expert in computer sciences, but am a python enthusiast. Why do you need this additional layer of indir

variable question

2008-07-11 Thread happy
Can a variable be considered the simplest of the data structures. I am tutoring some kids about basics of programming using python. Not an expert in computer sciences, but am a python enthusiast. I wanted to know if it is correct to say a variable is a data structure, it has a name and a value. Pu

Re: variable question

2008-07-10 Thread norseman
Support Desk wrote: I am trying to assign a variable using an if / else statement like so: If condition1: Variable = something If condition2: Variable = something else Do stuff with variable. But the variable assignment doesn't survive outside the if stateme

Re: variable question

2008-07-09 Thread Terry Reedy
Support Desk wrote: I am trying to assign a variable using an if / else statement like so: If condition1: Variable = something If condition2: Variable = something else Do stuff with variable. But the variable assignment doesn’t survive outside the if statement.

Re: variable question

2008-07-09 Thread Russell Blau
"Support Desk" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am trying to assign a variable using an if / else statement like so: > If condition1: > Variable = something > If condition2: > Variable = something else > Do stuff with variable. > > But the v

variable question

2008-07-09 Thread Support Desk
I am trying to assign a variable using an if / else statement like so: If condition1: Variable = something If condition2: Variable = something else Do stuff with variable. But the variable assignment doesn't survive outside the if statement. Is there any better w

Re: a class variable question

2006-06-28 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > hi > i have define a class like this > # class A: class A(object): > _var1 = 0 > def __init__(self): > ## some initialization > self.func1() > # def func1(): def func1(self): > .

Re: a class variable question

2006-06-28 Thread Steve Holden
Erik Max Francis wrote: [...] > All you're doing in your example is setting a local variable inside the > func1 method, which has no effect. > I think EMF was thinking, but failed to write, "outside the function" at the end of that sentence ;-) regards Steve -- Steve Holden +44 150 684

Re: a class variable question

2006-06-28 Thread Pierre Quentel
Erik Max Francis wrote: > Note this only changes the attribute in the instance. If he wants it to > be changed for all other instances, he needs to change it in the class > with:: A._var1 = 1 Yes, but in the OP's code func1() is called by __init__ for every instance - which in fact makes declari

Re: a class variable question

2006-06-27 Thread Erik Max Francis
Pierre Quentel wrote: > In func1, _var1 = 1 creates a local variable _var1 (local to the > method), not an attribute of the instance. If you want an instance > attribute you must specify the reference to the instance by > self._var1 = 1 ; self must be passed as an attribute to func1 > > def f

Re: a class variable question

2006-06-27 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > class A: > _var1 = 0 > def __init__(self): > ## some initialization > self.func1() > > def func1(): > . > _var1 = 1 > You mean:: class A:

Re: a class variable question

2006-06-27 Thread Marco Wahl
Hi, just some lines added below. hth [EMAIL PROTECTED] wrote: > hi > i have define a class like this > > class A: > _var1 = 0 > def __init__(self): > ## some initialization > self.func1() > > def func1(): se

Re: a class variable question

2006-06-27 Thread Pierre Quentel
In func1, _var1 = 1 creates a local variable _var1 (local to the method), not an attribute of the instance. If you want an instance attribute you must specify the reference to the instance by self._var1 = 1 ; self must be passed as an attribute to func1 def func1(self): self._var1 = 1

a class variable question

2006-06-27 Thread micklee74
hi i have define a class like this class A: _var1 = 0 def __init__(self): ## some initialization self.func1() def func1(): . _var1 = 1 def getvarValue(self):