Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95658
| Path | csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; '*is*': 0.09; '[0,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'jan': 0.11; 'iterated': 0.16; 'iterator': 0.16; 'range(0,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'am,': 0.23; 'tim': 0.24; 'header:In-Reply- To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints- To:1': 0.26; 'separate': 0.27; 'sequence': 0.27; 'chase': 0.29; 'class': 0.33; 'instance': 0.35; 'to:addr:python-list': 0.36; 'received:org': 0.37; 'why': 0.39; 'to:addr:python.org': 0.40; 'times': 0.63; 'subject:,': 0.82; 'received:fios.verizon.net': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: [a,b,c,d] = 1,2,3,4 |
| Date | Wed, 26 Aug 2015 11:16:46 -0400 |
| References | <CAPM-O+y-FftPRv7_VqSG6JVp3ocr__yd=RuppLh5ZWcMg25v+g@mail.gmail.com> <935842626.955183.1440514765199.JavaMail.root@sequans.com> <20150826072134.03ed9e71@bigbox.christie.dr> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-98-114-97-173.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
| In-Reply-To | <20150826072134.03ed9e71@bigbox.christie.dr> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.49.1440602243.11709.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1440602243 news.xs4all.nl 23819 [2001:888:2000:d::a6]:38797 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:95658 |
Show key headers only | View raw
On 8/26/2015 8:21 AM, Tim Chase wrote: >> a, b, c = (x for x in range(3)) # a generator for instance > > Since range() *is* a generator, why not just use In Python 3, range is a sequence class with a separate iterator class >>> r = range(3) >>> r range(0, 3) >>> iter(r) <range_iterator object at 0x00000000034682D0> Like all sequences, a range object can be iterated multiple times as a new iterator is used each time. >>> list(r) [0, 1, 2] >>> list(r) [0, 1, 2] -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: [a,b,c,d] = 1,2,3,4 Terry Reedy <tjreedy@udel.edu> - 2015-08-26 11:16 -0400
csiph-web