BUG: check if object provides len() before trying to iterate it

some libraries want object arrays from objects that are iterable but
rely on not providing len() to get the right dtype from numpy.
closes gh-5100
Merge pull request #5106 from juliantaylor/sequence-fix

BUG: check if object provides len() before trying to iterate it