Use self.vars in class.method(parameters, self.vars)

Chris Torek nospam at
Sat Jul 23 00:22:27 CEST 2011

In article <0ddc2626-7b99-46ee-9974-87439ae09f1e at>
caccolangrifata  <caccolangrifata at> wrote:
>I'm very very new with python, and I have some experience with java
>programming, so probably you guys will notice.
>Anyway this is my question:
>I'd like to use class scope vars in method parameter ...

Others have answered what appears to have been your actual
question.  Here's an example of using an actual "class scope

(Note: I have a sinus headache, which is probably the source
of some of the weirder names :-) )

class Florg(object):
    _DEFAULT_IPPY = 17

    def set_default_ippy(cls, ippy):
        cls._DEFAULT_IPPY = ippy

    def __init__(self, name, ippy = None):
        if ippy is None:
            ippy = self.__class__._DEFAULT_IPPY = name
        self.ippy = ippy

    def zormonkle(self):
        print('%s ippy = %s' % (, self.ippy))

def example():
    flist = [Florg('first')]
    flist.append(Florg('third', 5))
    flist.append(Florg('fifth', 5))

    for florg in flist:

if __name__ == '__main__':
In-Real-Life: Chris Torek, Wind River Systems
Intel require I note that my opinions are not those of WRS or Intel
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W)  +1 801 277 2603
email: gmail (figure it out)

More information about the Python-list mailing list