trying to grasp OO : newbie Q?

mitsura at skynet.be mitsura at skynet.be
Thu Apr 13 10:06:08 EDT 2006


Hi,

I just started with Python and I am new to OO programming.
Here is a simple code:
"
class Obj:
	myVar = 1

	def __init__(self):
		myVar = 2

#


myObj = Obj()

print myObj.myVar
"

The output is of this script is '1'. I would except it to be '2'.
I not understanding something fundamentally here.

Can anybody explain?

With kind regards,

Kris




More information about the Python-list mailing list