Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73233
| X-Received | by 10.182.118.162 with SMTP id kn2mr746836obb.42.1402598228093; Thu, 12 Jun 2014 11:37:08 -0700 (PDT) |
|---|---|
| X-Received | by 10.140.109.199 with SMTP id l65mr38839qgf.32.1402598228058; Thu, 12 Jun 2014 11:37:08 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!h3no237263igd.0!news-out.google.com!q9ni5211qaj.0!nntp.google.com!w8no369023qac.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.python |
| Date | Thu, 12 Jun 2014 11:37:07 -0700 (PDT) |
| In-Reply-To | <lncn90$t1m$1@speranza.aioe.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=2a02:120b:2c6f:21f0:b5df:a9cd:c5c9:d98d; posting-account=ung4FAoAAAC46zhHJ0Nsnuox7M5gDvs_ |
| NNTP-Posting-Host | 2a02:120b:2c6f:21f0:b5df:a9cd:c5c9:d98d |
| References | <8d6207ab-b883-4940-8e53-75546a91d4dd@googlegroups.com> <lnclm5$oe4$1@speranza.aioe.org> <mailman.11035.1402592234.18130.python-list@python.org> <lncn90$t1m$1@speranza.aioe.org> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <721c8c8e-3512-42cc-be19-ede489cef7d4@googlegroups.com> (permalink) |
| Subject | Re: About python while statement and pop() |
| From | wxjmfauth@gmail.com |
| Injection-Date | Thu, 12 Jun 2014 18:37:08 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Xref | csiph.com comp.lang.python:73233 |
Show key headers only | View raw
Le jeudi 12 juin 2014 19:16:19 UTC+2, Mark H. Harris a écrit : > On 6/12/14 11:57 AM, Chris Angelico wrote: > > >>>>> def poplist(L): > > >> done = False > > >> while done==False: > > >> > > >> yield L[::-1][:1:] > > >> L = L[::-1][1::][::-1] > > >> if len(L)==0: done=True > > > > > > Why not just "while L"? > > > > OK, here it is with Chris' excellent advice: > > > > >>> def poplist(L): > > while L: > > yield L[::-1][:1:] > > L = L[::-1][1::][::-1] > > > > > > >>> L=[1, 2, 3, 4, 5, 6, 7] > > >>> m=[] > > >>> pop = poplist(L) > > >>> for n in poplist(L): > > m.append(n[0]) > > > > > > >>> m > > [7, 6, 5, 4, 3, 2, 1] > > >>> > > > > > > ========== aaaaah =================== >>> a = [1, 2, 3, 4, 5, 6, 7] >>> b = a[:] # si nécessaire, wenn nötig >>> b.reverse() >>> >>> a [1, 2, 3, 4, 5, 6, 7] >>> b [7, 6, 5, 4, 3, 2, 1] jmf
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
About python while statement and pop() hito koto <hitokoto2014@gmail.com> - 2014-06-11 20:12 -0700
Re:About python while statement and pop() Dave Angel <davea@davea.name> - 2014-06-11 22:34 -0500
Re: About python while statement and pop() Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2014-06-12 05:40 +0200
Re: About python while statement and pop() Chris Angelico <rosuav@gmail.com> - 2014-06-12 13:58 +1000
Re: About python while statement and pop() hito koto <hitokoto2014@gmail.com> - 2014-06-11 21:56 -0700
Re: About python while statement and pop() Chris Angelico <rosuav@gmail.com> - 2014-06-12 15:08 +1000
Re: About python while statement and pop() Steven D'Aprano <steve@pearwood.info> - 2014-06-12 05:43 +0000
Re: About python while statement and pop() hito koto <hitokoto2014@gmail.com> - 2014-06-11 23:06 -0700
Re: About python while statement and pop() hito koto <hitokoto2014@gmail.com> - 2014-06-12 00:13 -0700
Re: About python while statement and pop() hito koto <hitokoto2014@gmail.com> - 2014-06-12 02:51 -0700
Re: About python while statement and pop() Mark H Harris <harrismh777@gmail.com> - 2014-06-12 11:41 -0500
Re: About python while statement and pop() Mark H Harris <harrismh777@gmail.com> - 2014-06-12 11:49 -0500
Re: About python while statement and pop() Marko Rauhamaa <marko@pacujo.net> - 2014-06-12 19:55 +0300
Re: About python while statement and pop() Mark H Harris <harrismh777@gmail.com> - 2014-06-12 12:07 -0500
Re: About python while statement and pop() Chris Angelico <rosuav@gmail.com> - 2014-06-13 02:57 +1000
Re: About python while statement and pop() Mark H Harris <harrismh777@gmail.com> - 2014-06-12 12:10 -0500
Re: About python while statement and pop() Mark H Harris <harrismh777@gmail.com> - 2014-06-12 12:16 -0500
Re: About python while statement and pop() wxjmfauth@gmail.com - 2014-06-12 11:37 -0700
csiph-web