[Tutor] another newbie question
David Jansen
djansen@pobox.com
Tue, 11 Jul 2000 08:37:14 +0900
In A. Gauld's document.py (a copy of which is posted at
http://www.sky.sannet.ne.jp/si75/document.py) in his Learning to Program
tutorial there is the following function:
def generateStats(self):
>>>>self.c_words = len(self.groups)
>>>>sentences, clauses = 0, 0
>>>>for c in self.stop_tokens:
>>>>>>>>sentences = sentences + self.c_punctuation[c]
>>>>self.c_sentence = sentences
>>>>for c in self.c_punctuation.keys():
>>>>>>>>clauses = clauses + self.c_punctuation[c]
>>>>self.c_clause = clauses
Now my question is why it is necessary to add the sentences = sentences +...
and clauses = clauses +... lines? Why not just:
self.c_sentence = self.c_sentence + self.c_punctuation[c]
and
self.c_clause = self.c_clause + self.c_punctuation[c]
Thank you,
David