Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!newsfeed.freenet.ag!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'subject:iterable': 0.09; 'yeah,': 0.09; 'cc:addr:python-list': 0.11; 'itself.': 0.14; 'dict': 0.16; 'effect,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iterates': 0.16; 'iterating': 0.16; 'iteration': 0.16; 'iterator': 0.16; 'reedy': 0.16; 'say.': 0.16; 'sequence,': 0.16; 'them...': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'basically': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'sep': 0.31; 'yields': 0.31; 'received:google.com': 0.35; 'sequence': 0.36; "didn't": 0.36; 'subject:?': 0.36; 'anything': 0.39; 'realize': 0.39; 'how': 0.40; 'till': 0.61; 'new': 0.61; "you're": 0.61; 'forward': 0.65; '20,': 0.68; 'subject:there': 0.68; 'bag': 0.74; 'collection.': 0.84; 'dict.': 0.84; 'heh.': 0.84; 'subject:check': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=MPhZITVt768fuF8C+D6cBZJjF56qilhIpCa9nzEMgGo=; b=NyTmhXemhOaqqgIa8bao6dMJnXwVq4RBSo3tCdqivTgT4SNfzXhzPeRTGS5/qp0FJK OnbxPNWuYPWRqbeVWwg8Ttt9v6zgirGK5Ep0EHTeAdYKTeB8+DHictLexrVMd88xryHO amNREXXACC2Oe6o1HmcgmRM3mCoJLhHXVhmBkRgA8LT5Jc9WJk5b+97wQIjMRQIIsljg mJ/pUU/d4zUtmTXY8PaXS11wd+oeoY+bYGWR80ForiRdNlDG5NKkGnZHyi+D8kgCY5RK R5leQAkM2JbWgCeOvkFHNPcXVxoSR6Cx3AAAhh+xHzypzGPuYEMoIVXJTQsUVU5hVzQ7 9DVw== MIME-Version: 1.0 X-Received: by 10.50.117.65 with SMTP id kc1mr1134367igb.34.1411189287585; Fri, 19 Sep 2014 22:01:27 -0700 (PDT) In-Reply-To: References: Date: Sat, 20 Sep 2014 15:01:27 +1000 Subject: Re: Is there a canonical way to check whether an iterable is ordered? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411189295 news.xs4all.nl 2860 [2001:888:2000:d::a6]:53052 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78097 On Sat, Sep 20, 2014 at 8:02 AM, Terry Reedy 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