Chris,

I was just fooling around and I wanted to do something for myself before
going to bed the other night.

func myflatten will turn say [ 34 [90] [12] 1] into [34 90 12 1].

Just like its name sounds.

Emeka

On Fri, Aug 12, 2011 at 7:03 PM, Christopher King <g.nius...@gmail.com>wrote:

>       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
>
>


-- 
*Satajanus  Nig. Ltd


*
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to