[Tutor] Using type

Emeka emekamicro at gmail.com
Fri Aug 12 08:04:49 CEST 2011


Hello All,

I need help here, type(item) == [].__class__:. What is the idiomatic way of
doing it?

def myflatten(my_data):

  gut = []

  for item in my_data:
       if type(item) == [].__class__:
        gut =  gut + myflatten ( item)
       else:
         gut.append(item)

  return gut
print myflatten(goo)

-- 
*Satajanus  Nig. Ltd


*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110812/a117d4e9/attachment.html>


More information about the Tutor mailing list