member variables in python

Grant Edwards grante at visi.com
Fri Mar 31 11:16:32 EST 2006


On 2006-03-31, PyPK <superprad at gmail.com> 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 something that's used
by multiple classes in the module, then module-scope seems like
the logical choice.

> 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?

Dunno.  What are "member varibles"?

-- 
Grant Edwards                   grante             Yow!  Don't SANFORIZE me!!
                                  at               
                               visi.com            



More information about the Python-list mailing list