By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,818 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,818 IT Pros & Developers. It's quick & easy.

Proper Way of checking for a collections class

P: n/a

I've been trying to find a good idiom for testing if the input to a
function is one of the collections classes... the best I could do is this:

if hasattr(thing_to_test, '__iter__'):

Is this right? Or, is there a better way besides a cascade of type()



Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.