Is there a canonical way to check whether an iterable is ordered?
Chris Angelico
rosuav at gmail.com
Sat Sep 20 01:01:27 EDT 2014
On Sat, Sep 20, 2014 at 8:02 AM, Terry Reedy <tjreedy at udel.edu> wrote:
>> That's what you're iterating over - not the bag itself.
>
> If one iterates over anything other that a sequence, in forward order, then
> one is, in effect, iterating over a new sequence generated from the 'base'
> collection. In particular, set and dict iteration iterates over an
> arbitrary serialization of the set or dict.
Yeah, that's basically what I was trying to say. Didn't realize how
empty the statement was till you dug deeper into it, heh. Yes, an
iterator yields the items it yields, in the order it yields them...
*twiddles thumbs*
ChrisA
More information about the Python-list
mailing list