>
>       try:
>          iter(item)  # test for iterability
>          if len(item) == 1 and item == item[0]:
>              gut.append(item)
>          else:
>              gut = gut + flatten(item)
>
>       except TypeError:
>          gut.append(item)
>
I wouldn't put the what you want to do if there is no error in the
try statement. It makes it appear like your checking for an error in all the
code. I would do.

      try:
         iter(item)  # test for iterability
      except TypeError:
         gut.append(item)
      else:
         if len(item) == 1 and item == item[0]: ##By the way, why do you
have this if statment
             gut.append(item)
         else:
             gut = gut + flatten(item)

Oh ya out of curiosity, what is the flatten func for?
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to