Is there a canonical way to check whether an iterable is ordered?
rosuav at gmail.com
Thu Sep 18 14:10:42 CEST 2014
On Thu, Sep 18, 2014 at 9:55 PM, cool-RR <ram.rachum at gmail.com> wrote:
> 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?
An iterable is always ordered. You call next() and you get the next
value. Are you asking if there's a way to find out if the order
matters? Not easily. What's your use-case? Why do you need to know?
Also, you're still using Google Groups, which means your formatting is
b0rked. Please can you use something better, or else look into fixing
More information about the Python-list