Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #89584
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.027 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'subject:Python': 0.06; 'element': 0.07; '[1,': 0.09; 'cest': 0.09; 'omit': 0.09; 'slices': 0.09; 'bug': 0.12; 'doing,': 0.16; 'slice,': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'this?': 0.23; 'error': 0.23; 'deleted.': 0.24; 'skip': 0.24; 'wednesday': 0.24; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'concise': 0.31; 'subject:numbers': 0.31; 'probably': 0.32; 'supposed': 0.32; 'received:google.com': 0.35; 'list': 0.37; 'clear': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'deleting': 0.60; 'ian': 0.60; 'middle': 0.60; 'negative': 0.60; 'term': 0.63; 'more': 0.64; '(5)': 0.74; 'ranges': 0.74; '2015': 0.84; 'clearer': 0.84; 'faster.': 0.84 |
| 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=7nF65qM+2+Gimzjtaybq+7gv8N/SFOkOpHpF6gVEiDc=; b=FUi6dgHcmcW43V87GXJXB70vOWTN9UxIXk5u826eel/TWaqyPkMnyHCb4LEIWdmwvb srqyIkhEo21BumlHRGJ6kd5aAtFreKRkHY5qZDRdaSAWVjxQNW9qPVg3TChdeY9Y0NHr aLqc1dBTyRAm3UOXXoTzi7TINB03DjPo26hlldtuPl/0dY6L1wI6XOcQU2a9ZqdYJKN1 HuHMc/oYHKJacC6cnW7rmFV4NJpli9iQHe1CWPEcI/6nyBpa1CgJHIt/zqx+iOrpwuBe 9EitQbFjic5VgLT6IFfvtdQIjclZCqiv/OFk50R+QkAgGDJ5gu+UC79+loVXCBaAvpBL V1gQ== |
| X-Received | by 10.107.136.89 with SMTP id k86mr1689245iod.63.1430347163763; Wed, 29 Apr 2015 15:39:23 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <87d22mbod7.fsf@Equus.decebal.nl> |
| References | <87lhhabxod.fsf@Equus.decebal.nl> <mailman.95.1430337506.3680.python-list@python.org> <87d22mbod7.fsf@Equus.decebal.nl> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Wed, 29 Apr 2015 16:38:43 -0600 |
| Subject | Re: Lucky numbers in Python |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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.103.1430347166.3680.python-list@python.org> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1430347166 news.xs4all.nl 2850 [2001:888:2000:d::a6]:58101 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:89584 |
Show key headers only | View raw
On Wed, Apr 29, 2015 at 3:45 PM, Cecil Westerhof <Cecil@decebal.nl> wrote: > Op Wednesday 29 Apr 2015 21:57 CEST schreef Ian Kelly: >> And although it's not clear to me what this is supposed to be doing, >> you probably no longer need the middle term if the intention is to >> continue deleting all the way to the end of the list (if it is then >> I think you have a bug in the existing implementation, since the >> last item in the list can never be deleted). > > What do you mean by this? Executing: > lucky_numbers(5) > gives: > [1, 3] > > So the last element (5) is deleted. Off by one error on my part. This is why negative skip values on ranges and slices are not recommended: they're confusing. :-) In that case you can definitely omit the middle term of the slice, which will be both more concise and clearer in intent, though probably not significantly faster.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Lucky numbers in Python Cecil Westerhof <Cecil@decebal.nl> - 2015-04-29 20:24 +0200
Re: Lucky numbers in Python Ian Kelly <ian.g.kelly@gmail.com> - 2015-04-29 13:57 -0600
Re: Lucky numbers in Python Cecil Westerhof <Cecil@decebal.nl> - 2015-04-29 23:45 +0200
Re: Lucky numbers in Python Ian Kelly <ian.g.kelly@gmail.com> - 2015-04-29 16:38 -0600
Re: Lucky numbers in Python Cecil Westerhof <Cecil@decebal.nl> - 2015-04-30 02:01 +0200
Re: Lucky numbers in Python Ian Kelly <ian.g.kelly@gmail.com> - 2015-04-29 20:55 -0600
Re: Lucky numbers in Python Cecil Westerhof <Cecil@decebal.nl> - 2015-04-30 08:34 +0200
Re: Lucky numbers in Python Chris Kaynor <ckaynor@zindagigames.com> - 2015-04-29 15:56 -0700
Re: Lucky numbers in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-30 10:11 +1000
Re: Lucky numbers in Python Ian Kelly <ian.g.kelly@gmail.com> - 2015-04-29 21:08 -0600
Re: Lucky numbers in Python Cecil Westerhof <Cecil@decebal.nl> - 2015-04-30 20:55 +0200
Re: Lucky numbers in Python Dave Angel <davea@davea.name> - 2015-04-30 15:28 -0400
csiph-web