Just curious, what are the pros and cons of the following patterns?
pattern 1
class Myclass:
def __init__(self):
self.val = "foo"
self.process()
def process(self):
#do_sth on self.val
pattern 2
class Myclass:
def __init__(self):
self.val = "foo"
self.process(self.val)
def process(self, val):
#do_sth on val
Which one is preferable, and why?
Thanks!!!
Aucun commentaire:
Enregistrer un commentaire