a class variable question

Erik Max Francis max at alcyone.com
Wed Jun 28 02:17:48 EDT 2006


micklee74 at hotmail.com wrote:

> class A:
>          _var1 = 0
>          def __init__(self):
>                  ## some initialization
>                  self.func1()
> 
>          def func1():
>                   .....
>                  _var1 = 1
>                  ....

You mean::

	class A:
	    _var1 = 0

	    ...

	    def func1(self):
	        A._var1 = 1

All you're doing in your example is setting a local variable inside the 
func1 method, which has no effect.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
  San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   Every path has its puddle.
    -- (an English proverb)



More information about the Python-list mailing list