Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76255

Re: how to change the time string into number?

References <53EC14EC.2090503@gmail.com> <20140813210111.197005cd@bigbox.christie.dr> <mailman.12958.1407982655.18130.python-list@python.org> <53ec2453$0$2299$426a74cc@news.free.fr>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2014-08-13 21:07 -0600
Subject Re: how to change the time string into number?
Newsgroups comp.lang.python
Message-ID <mailman.12964.1407985691.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, Aug 13, 2014 at 8:51 PM, YBM <ybmess@nooos.fr.invalid> 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 "<stdin>", line 1, in <module>
TypeError: 'range_iterator' object is not subscriptable

The only methods you can rely upon an arbitrary iterator to have are
__iter__ and __next__.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: how to change the time string into number? Tim Chase <python.list@tim.thechases.com> - 2014-08-13 21:16 -0500
  Re: how to change the time string into number? YBM <ybmess@nooos.fr.invalid> - 2014-08-14 04:51 +0200
    Re: how to change the time string into number? Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-13 21:07 -0600
    Re: how to change the time string into number? Roy Smith <roy@panix.com> - 2014-08-13 23:14 -0400
  Re: how to change the time string into number? Marko Rauhamaa <marko@pacujo.net> - 2014-08-14 08:19 +0300

csiph-web