Re: Making helper methods more concise

2012-04-16 Thread Terry Reedy
On 4/16/2012 8:01 AM, Alan Ristow wrote: Hi all, I have defined a class that includes a number of helper methods that are useful to me, but pretty redundant. Something like so, where I maintain a list of tuples: class A(object): def __init__(self): self.listing = [] # This m

Re: Making helper methods more concise

2012-04-16 Thread Arnaud Delobelle
On 16 April 2012 13:29, Arnaud Delobelle wrote: > You can do this (untested), but no doubt it won't be to everybody's taste: > > class A(object): >   def __init__(self): >       self.listing = [] > >   # This method does the work. >   def append_text(self, text, style): >       self.listing.append

Re: Making helper methods more concise

2012-04-16 Thread Arnaud Delobelle
On 16 April 2012 13:01, Alan Ristow wrote: > Hi all, > > I have defined a class that includes a number of helper methods that > are useful to me, but pretty redundant. Something like so, where I > maintain a list of tuples: > > class A(object): >    def __init__(self): >        self.listing = [] >

Making helper methods more concise

2012-04-16 Thread Alan Ristow
Hi all, I have defined a class that includes a number of helper methods that are useful to me, but pretty redundant. Something like so, where I maintain a list of tuples: class A(object): def __init__(self): self.listing = [] # This method does the work. def append_text(self,