Hi, I have some classes that print variable outputs depending on their internal state, like so:
def __str__(self):
out = []
if self.opt1: out += ['option 1 is %s' % self.opt1']
if self.opt2: out += ['option 2 is %s' % self.opt2']
....
return '\n'.join(out)
Is there any way to make this cleaner?
-- http://mail.python.org/mailman/listinfo/python-list
