How to use a parameter in a class

Decebal CLDWesterhof at gmail.com
Sat May 3 06:05:31 EDT 2008


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?



More information about the Python-list mailing list