R
Ray Schumacher
What is the feeling on using "parent" in a class definition that
class methods can refer to, vs. some other organization ?
Should all relevant objects/vars just be passed into the method as needed?
It seems like including "parent" in the class def is just like a
class variable, which most do not recommend.
An example:
class LXSerial:
def __init__(self, parent, debug=False):
...
def connect(self, port, baud=9600, ptimeout=10):
if self.debug:
self.connectedPort = StringIO.StringIO(':A#')
else:
if self.parent.model=='LX200GPS': ptimeout = 240
...
Ray
class methods can refer to, vs. some other organization ?
Should all relevant objects/vars just be passed into the method as needed?
It seems like including "parent" in the class def is just like a
class variable, which most do not recommend.
An example:
class LXSerial:
def __init__(self, parent, debug=False):
...
def connect(self, port, baud=9600, ptimeout=10):
if self.debug:
self.connectedPort = StringIO.StringIO(':A#')
else:
if self.parent.model=='LX200GPS': ptimeout = 240
...
Ray