def iterlen(items):
 try:
  return len(items)
 except TypeError:
  for (i, x) in enumerate(items):
   count = i
  return (count + 1)

def iterlen ( items ) : try : return len ( items ) except TypeError : for ( i , x ) in enumerate ( items ) : count = i return ( count + 1 )
count the number of items in an iterable .