Is there a canonical way to check whether an iterable is ordered?

cool-RR ram.rachum at gmail.com
Thu Sep 18 07:55:37 EDT 2014


My function gets an iterable of an unknown type. I want to check whether it's ordered. I could check whether it's a `set` or `frozenset`, which would cover many cases, but I wonder if I can do better. Is there a nicer way to check whether an iterable is ordered or not? 


Thanks,
Ram.



More information about the Python-list mailing list