[Tutor] object design question

Kent Tenney ktenney at gmail.com
Tue May 15 15:25:55 CEST 2007


Howdy,

I would be interested in some discussion of
which of the following approaches is preferred and why. 

class RstManager:
    
    def __init__(self, text):
        self.text = text
        self.parseRst()
        
    def parseRst(self):
        parsed = <do stuff to self.text>
        self.parsed = parsed
        
        
class RstManager:
    
    def __init__(self, text):
        self.parsed = parseRst(text)
        
    def parseRst(self, text):
        parsed = <do stuff to text>
        return parsed


Thanks,
Kent



More information about the Tutor mailing list