C
caccolangrifata
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, something like
that
class foo(object):
__init__(self, len = 9):
self.__myvar = len
def foo2(self, len = self_myvar):
while i < len:
dosomething
I want to use optional parameter, so i can use
myfoo = foo() or myfoo = foo(20)
and also
foo.foo2(20) or foo.foo2()
but in def foo2(self, len = self_myvar):
^
self is undefined, so:
How can I do this stuff?
programming, so probably you guys will notice.
Anyway this is my question:
I'd like to use class scope vars in method parameter, something like
that
class foo(object):
__init__(self, len = 9):
self.__myvar = len
def foo2(self, len = self_myvar):
while i < len:
dosomething
I want to use optional parameter, so i can use
myfoo = foo() or myfoo = foo(20)
and also
foo.foo2(20) or foo.foo2()
but in def foo2(self, len = self_myvar):
^
self is undefined, so:
How can I do this stuff?