D
dmitrey
Hi all,
I have the code like this one:
from myMisc import ooIter
class MyClass:
def __init__(self): pass
iterfcn = lambda *args: ooIter(self) # i.e pass the class instance
to other func named ooIter
field2 = val2
field3 = val3 # etc
So it yields "global name 'self' is not defined", that is true. How
could I handle the situation?
Currently I do (and it works, but give me some troubles - I should
call MyClass.__init__ for each children class, and there are lots of
those ones)
class MyClass:
def __init__(self):
iterfcn = lambda *args: ooIter(self) # i.e pass the class
instance to other func named ooIter
field2 = val2
field3 = val3 # etc
I suspect it has better solution, is it?
Thank you in advance, Dmitrey
I have the code like this one:
from myMisc import ooIter
class MyClass:
def __init__(self): pass
iterfcn = lambda *args: ooIter(self) # i.e pass the class instance
to other func named ooIter
field2 = val2
field3 = val3 # etc
So it yields "global name 'self' is not defined", that is true. How
could I handle the situation?
Currently I do (and it works, but give me some troubles - I should
call MyClass.__init__ for each children class, and there are lots of
those ones)
class MyClass:
def __init__(self):
iterfcn = lambda *args: ooIter(self) # i.e pass the class
instance to other func named ooIter
field2 = val2
field3 = val3 # etc
I suspect it has better solution, is it?
Thank you in advance, Dmitrey