Augmented Assignment question

John Machin sjmachin at lexicon.net
Fri Jul 18 20:52:39 EDT 2003


Doug Tolton <dtolton at yahoo.com> wrote in message news:<215bhv0bnkn13eivh0s64ic5ml8obpgfg7 at 4ax.com>...
> I have a function that returns a tuple:
> 
>     def checkdoc(self, document):
>         blen = document['length']
>         bates = document['obates']
> 
>         normal, truncated, semicolon = 0,0,0
>         for bat in bates:
>             if len(bat) == 2 * blen:
>                 semicolon += 1
>             if len(bat) == blen - 1:
>                 truncated += 1
>             if len(bat) == blen:
>                 normal += 1

          self.total_normal += normal
          # etc etc
          # someone else suggested a separate class just for statistics
          # --- this is overkill IMHO
> 
>         return normal, truncated, semicolon
>




More information about the Python-list mailing list