Hello Decebal,
I am new to python myself, which might be the cause why I do not get
that "last line" at all. To me it looks like you are trying to set a
variable in the class body (if I am reading the indent correctly) and
call a function (that does not exist?) to calculate the value for it.
Does that work at all?
About a week ago I learned something, that might solve your problem:
You can only access the instance's variables from within a function.
The variable is not visible from the outside. To get that value (12 on
your example) you have to be in a function, or call your returnValue()
function from the outside.
I hope, that I did not waste your time with my lowest level knowledge.
Have a nice weekend,
Florian
On Sat, May 3, 2008 at 12:05 PM, Decebal <CL**********@gmail.comwrote:
I have the following class:
#####
class Dummy():
value = 0
def __init__(self, thisValue):
print thisValue
self.value = thisValue
value = thisValue
def testing(self):
print 'In test: %d' % self.value
def returnValue(self):
return self.value
result = someFuntion(default = value)
#####
But the last line does not work.
I would like to do a call like:
dummy = Dummy(thisValue = 12)
And that someFunction gets a default value of 12. How can I do that?
--
http://mail.python.org/mailman/listinfo/python-list