Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39895
| Path | csiph.com!usenet.pasdenom.info!goblin1!goblin.stu.neva.ru!news.astraweb.com!border5.a.newsrouter.astraweb.com!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.028 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'any.': 0.09; 'loop.': 0.09; 'semantics': 0.09; 'slices': 0.09; 'discussion.': 0.16; 'list;': 0.16; 'loops': 0.16; 'mainstream': 0.16; 'ranges.': 0.16; 'subject:)?': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'feb': 0.19; 'meant': 0.21; "haven't": 0.23; 'specifically': 0.24; 'header:In- Reply-To:1': 0.25; 'am,': 0.27; 'andrew': 0.27; 'message- id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'actual': 0.28; 'run': 0.28; 'accidentally': 0.29; 'necessary,': 0.29; 'not.': 0.32; 'problem': 0.33; 'to:addr:python-list': 0.33; 'code:': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'next': 0.35; 'list.': 0.35; 'but': 0.36; 'should': 0.36; 'subject: (': 0.36; 'does': 0.37; 'two': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'notice': 0.39; 'application': 0.40; 'easy': 0.60; 'between': 0.63; 'different': 0.63; 'ranges': 0.71; '2013': 0.84; 'to:name:python': 0.84; 'true!': 0.84; 'besides,': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=TK2SIUepNPicK1zrmmU3XCVA4J4BAvVUuETI20Qc25U=; b=MsRFFCy2B5Zv9C2KRZk3Jzww1M/z3Bxe3PLihtqCtRFTzBVbud/uyrWEYW09M6sed8 7i5+lxkp3sJ/cwFafOanh7RcBHd/3c86Lv7Jb2NOTtm7Lm5ePyfQLJ6UkpXU/D4SbfkW Psn5JtJB15siXjAzJ4szlQDkjwWoHl2sR4ZuMlywAHCzsnSUr7vBU04QG8TwEyFaGRQF /vgshZ04ExazA6JJfbbAEc2mCeDUnA65c0KpjWXwZAC5SgbvPvpx2CE7fGolzlTl8FrV ZsPK49IXae54Xhbq2NISU0Sxy00bL1iDVD1c/zr6ez6AYTEpkupCfwzIBGabjKNnpG6T Fx9A== |
| X-Received | by 10.52.22.194 with SMTP id g2mr8956060vdf.91.1361811336206; Mon, 25 Feb 2013 08:55:36 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <512B15C0.8070106@r3dsolutions.com> |
| References | <2e07acfb-4f48-4a27-9b06-3d8103325c0f@googlegroups.com> <kfhsc2$ubq$1@ger.gmane.org> <512ABA02.2080709@r3dsolutions.com> <CALwzid=Dobx0F1Gm3E-Oq0vZf8V6SaNmb3j4SBmty1DDAffwLg@mail.gmail.com> <512B15C0.8070106@r3dsolutions.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Mon, 25 Feb 2013 09:54:56 -0700 |
| Subject | Re: Suggested feature: slice syntax within tuples (or even more generally)? |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2509.1361811338.2939.python-list@python.org> (permalink) |
| Lines | 36 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1361811339 news.xs4all.nl 6982 [2001:888:2000:d::a6]:55214 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:39895 |
Show key headers only | View raw
On Mon, Feb 25, 2013 at 12:41 AM, Andrew Robinson <andrew3@r3dsolutions.com> wrote: >> Intuitively, it should result in an infinite loop starting at 0. But >> ranges require a stop value for a very good reason -- it should not be >> this easy to accidentally create an infinite for loop. > > ... > and, besides, the same is true with other constructions of loops.... > > while a: # Damn easy, if a is accidentally true! Notice I specifically said an "infinite *for* loop". While loops are meant to be indeterminate in the number of iterations they will take going into the loop; for loops are not. >> The next problem you run into is that the semantics of negative >> numbers are completely different between slices and ranges. Consider >> this code: >> >> s = (-5:6) >> for i in s: >> print(i) >> for i in range(6)[s]: >> print(i) > > I don't find this difference to be necessary, nor objectionable. > > It is less inconsistent, in my view, to allow that > ([ 1,2,3,4,5 ])[-1:2] produce [5,1,2] than an empty list; > and ([ 1,2,3,4,5])[2:-1] does produce an empty list. > > I have been looking for actual programs that this would break for over two > months now, and I haven't been finding any. I am willing to run any > mainstream application you can find on test-patched python! Yes, I recollect now that we have already had this discussion.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Suggested feature: slice syntax within tuples (or even more generally)? stephenwlin@gmail.com - 2013-02-13 11:00 -0800
Re: Suggested feature: slice syntax within tuples (or even more generally)? Terry Reedy <tjreedy@udel.edu> - 2013-02-14 00:23 -0500
Re: Suggested feature: slice syntax within tuples (or even more generally)? stephenwlin@gmail.com - 2013-02-13 21:54 -0800
Re: Suggested feature: slice syntax within tuples (or even more generally)? stephenwlin@gmail.com - 2013-02-13 21:54 -0800
Re: Suggested feature: slice syntax within tuples (or even more generally)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-14 07:32 +0000
Re: Suggested feature: slice syntax within tuples (or even more generally)? stephenwlin@gmail.com - 2013-02-14 00:36 -0800
Re: Suggested feature: slice syntax within tuples (or even more generally)? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-14 08:03 +0000
Re: Suggested feature: slice syntax within tuples (or even more generally)? stephenwlin@gmail.com - 2013-02-14 01:08 -0800
Re: Suggested feature: slice syntax within tuples (or even more generally)? stephenwlin@gmail.com - 2013-02-14 01:26 -0800
Re: Suggested feature: slice syntax within tuples (or even more generally)? Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-14 11:58 -0700
Re: Suggested feature: slice syntax within tuples (or even more generally)? stephenwlin@gmail.com - 2013-02-14 14:01 -0800
Re: Suggested feature: slice syntax within tuples (or even more generally)? stephenwlin@gmail.com - 2013-02-14 14:01 -0800
Re: Suggested feature: slice syntax within tuples (or even more generally)? Rick Johnson <rantingrickjohnson@gmail.com> - 2013-02-14 17:46 -0800
Re: Suggested feature: slice syntax within tuples (or even more generally)? Rick Johnson <rantingrickjohnson@gmail.com> - 2013-02-14 17:46 -0800
Re: Suggested feature: slice syntax within tuples (or even more generally)? stephenwlin@gmail.com - 2013-02-13 22:06 -0800
Re: Suggested feature: slice syntax within tuples (or even more generally)? Duncan Booth <duncan.booth@invalid.invalid> - 2013-02-14 12:25 +0000
Re: Suggested feature: slice syntax within tuples (or even more generally)? stephenwlin@gmail.com - 2013-02-14 07:56 -0800
Re: Suggested feature: slice syntax within tuples (or even more generally)? Andrew Robinson <andrew3@r3dsolutions.com> - 2013-02-25 01:10 +0000
Re: Suggested feature: slice syntax within tuples (or even more generally)? Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-25 03:28 -0700
Re: Suggested feature: slice syntax within tuples (or even more generally)? Terry Reedy <tjreedy@udel.edu> - 2013-02-25 06:23 -0500
Re: Suggested feature: slice syntax within tuples (or even more generally)? Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-25 09:54 -0700
Re: Suggested feature: slice syntax within tuples (or even more generally)? Andrew Robinson <andrew3@r3dsolutions.com> - 2013-02-25 09:47 +0000
Re: Suggested feature: slice syntax within tuples (or even more generally)? Nobody <nobody@nowhere.com> - 2013-02-26 07:38 +0000
csiph-web