Re: member variables in python

2006-03-31 Thread Kent Johnson
PyPK wrote: > ok I reason I was going with globals is that i use this variable in > another class something like this along with above > > testflag = 0 > > class AA: >def __init__(...): > > def methos(self,...): >global testflag >testflag = xx > > class BB: > def __ini

Re: member variables in python

2006-03-31 Thread bruno at modulix
PyPK wrote: > ok I reason I was going with globals is that i use this variable in > another class something like this along with above > > testflag = 0 > > class AA: >def __init__(...): > > def methos(self,...): >global testflag >testflag = xx > > class BB: > def __ini

Re: member variables in python

2006-03-31 Thread PyPK
I see that.But here in my case the testflags is computed inside the member function something like class AA: def __init__(self): self.test_flag = 0 # initialize def methods(self, value): save_value = _munge(value) self.test_flag = save_value N

Re: member variables in python

2006-03-31 Thread Fredrik Lundh
"PyPK" wrote: > hi how do I write this better with member variables rather than global > as you see below. > > eg: > > test-flag = 0 > > class AA: >def __init__(...): > > def methos(self,...): >global test-flag >test-flag = xx > > instead of something like above ..how do i pu

Re: member variables in python

2006-03-31 Thread Grant Edwards
On 2006-03-31, PyPK <[EMAIL PROTECTED]> wrote: > hi how do I write this better with member variables Sorry, I don't know what "member variables" are. > rather than global as you see below. What you did below isn't global. It's scope is limited to the module containing the class. If you got so

Re: member variables in python

2006-03-31 Thread PyPK
ok I reason I was going with globals is that i use this variable in another class something like this along with above testflag = 0 class AA: def __init__(...): def methos(self,...): global testflag testflag = xx class BB: def __init__(...): def method2(..): if

Re: member variables in python

2006-03-31 Thread Kent Johnson
PyPK wrote: > hi how do I write this better with member variables rather than global > as you see below. > > eg: > > test-flag = 0 > > class AA: >def __init__(...): > > def methos(self,...): >global test-flag >test-flag = xx > > instead of something like above ..how do i

member variables in python

2006-03-31 Thread PyPK
hi how do I write this better with member variables rather than global as you see below. eg: test-flag = 0 class AA: def __init__(...): def methos(self,...): global test-flag test-flag = xx instead of something like above ..how do i put it i terms of member variables? -- h