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
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
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
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
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
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.
"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
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
[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):
> .
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
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
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
[EMAIL PROTECTED] wrote:
> class A:
> _var1 = 0
> def __init__(self):
> ## some initialization
> self.func1()
>
> def func1():
> .
> _var1 = 1
>
You mean::
class A:
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
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
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):
16 matches
Mail list logo