Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.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.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:into': 0.09; 'subject:number': 0.09; 'subject:string': 0.09; 'iterator': 0.16; 'iterators': 0.16; 'typeerror:': 0.16; 'index': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '>>>': 0.22; 'aug': 0.22; '>>>': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; '"",': 0.31; '13,': 0.31; 'file': 0.32; '(most': 0.33; 'subject:time': 0.33; 'subject:the': 0.34; 'received:google.com': 0.35; 'method': 0.36; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'such': 0.63; 'thing,': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=LPo4IgIHw4zMnBrO/r+ieXgRgx/tzhgw36W8n6Wc3E4=; b=odcYtRZlQ2vhIopfPNcplsooKHR0F2TgayIEdENmtRbqv0Bsle1x7rXCHtiGLP65p4 cQFz6FufT7s5zeqZjs4RfGirhLr+2c6aJouIXsREu1as98vb37ELUtKKgx+atX1UtV4P GaTRrHblGHWVTuq7CFKyzg6rHtkT2ECxHMJkoAqb6LzMAX1DVq9F+3GxtwKOZghjS84m SmjEYbsmRPNQ4BXXPsfFl1BeBlKGm5RsQkhZe4XZQrTEft6OCLNi2n4kUWciLsgfhsCB LhP9Em6d24Le0icZtVIXWEwEykAzP1puLePFWs1PgxlJdO360cS8h5PkrTe/7vCyankh lrMQ== X-Received: by 10.67.24.73 with SMTP id ig9mr1591836pad.67.1407985688037; Wed, 13 Aug 2014 20:08:08 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <53ec2453$0$2299$426a74cc@news.free.fr> References: <53EC14EC.2090503@gmail.com> <20140813210111.197005cd@bigbox.christie.dr> <53ec2453$0$2299$426a74cc@news.free.fr> From: Ian Kelly Date: Wed, 13 Aug 2014 21:07:27 -0600 Subject: Re: how to change the time string into number? To: Python Content-Type: multipart/alternative; boundary=001a113408e8c8cfd905008e363a 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407985691 news.xs4all.nl 2880 [2001:888:2000:d::a6]:49429 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76255 --001a113408e8c8cfd905008e363a Content-Type: text/plain; charset=UTF-8 On Wed, Aug 13, 2014 at 8:51 PM, YBM wrote: > BTW, why iterators does not have such an index method ? Because iterators don't support indexing. In order to support such a thing, it would have to exhaust the iterator. >>> iter(range(5))[3] Traceback (most recent call last): File "", line 1, in TypeError: 'range_iterator' object is not subscriptable The only methods you can rely upon an arbitrary iterator to have are __iter__ and __next__. --001a113408e8c8cfd905008e363a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Wed, Aug 13, 2014 at 8:51 PM, YBM <ybmess@nooos.fr.i= nvalid> wrote:
> BTW, why iterators does not have such an index me= thod ?

Because iterators don't support indexing.= In order to support such a thing, it would have to exhaust the iterator.

>>> iter(range(5))[3]
Traceback= (most recent call last):
=C2=A0 File "<stdin>", = line 1, in <module>
TypeError: 'range_iterator' obj= ect is not subscriptable

The only methods you can rely upon an arbitrary i= terator to have are __iter__ and __next__.
--001a113408e8c8cfd905008e363a--