Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #92001
| Path | csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!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.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'defaults': 0.05; 'from:addr:yahoo.co.uk': 0.05; 'indices': 0.07; 'subject:How': 0.09; 'len(x)': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'slices': 0.09; 'python': 0.11; 'index': 0.13; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'selects': 0.16; 'sequence.': 0.16; 'subject:access': 0.16; 'zero,': 0.16; 'wrote:': 0.16; 'string': 0.17; 'language': 0.19; '>>>': 0.20; 'trying': 0.22; 'lawrence': 0.22; 'am,': 0.23; '2015': 0.23; 'seems': 0.24; 'header:In-Reply-To:1': 0.24; 'second': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints- To:1': 0.26; 'sequence': 0.27; 'subject:list': 0.28; 'omitted': 0.29; 'language.': 0.32; 'url:python': 0.33; 'useful': 0.35; 'to:addr:python-list': 0.35; 'something': 0.35; 'but': 0.36; 'being': 0.36; 'url:org': 0.36; 'thanks': 0.36; 'basic': 0.36; 'subject:: ': 0.37; 'tue,': 0.38; 'received:org': 0.38; 'say': 0.38; 'means': 0.39; 'enough': 0.39; 'url:docs': 0.39; 'to:addr:python.org': 0.39; 'sure': 0.40; 'mark': 0.40; 'subject:the': 0.40; 'url:3': 0.60; 'learn': 0.60; 'even': 0.61; 'entire': 0.61; 'matter': 0.63; 'our': 0.64; 'charset:windows-1252': 0.65; 'here': 0.66; 'teach': 0.70; 'pythonistas,': 0.84; 'utc+5:30,': 0.84; 'visually': 0.84; 'url:tutorial': 0.91; 'received:2': 0.93 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: How to access the low digits of a list |
| Date | Wed, 03 Jun 2015 22:41:33 +0100 |
| References | <efe9d48e-9aaf-4e68-aa26-c83da32e80f5@googlegroups.com> <18a4709f-47c8-41f7-87d5-08bbb00166b6@googlegroups.com> <mailman.63.1433254823.13271.python-list@python.org> <11005554-e89f-407c-8720-fae1bb3fced8@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | host-2-98-194-38.as13285.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
| In-Reply-To | <11005554-e89f-407c-8720-fae1bb3fced8@googlegroups.com> |
| 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.130.1433367715.13271.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1433367715 news.xs4all.nl 2969 [2001:888:2000:d::a6]:58859 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:92001 |
Show key headers only | View raw
On 03/06/2015 22:08, Rustom Mody wrote: > On Tuesday, June 2, 2015 at 7:50:58 PM UTC+5:30, Ian wrote: >> On Tue, Jun 2, 2015 at 6:35 AM, Rustom Mody wrote: >>> For that matter even this works >>> But I am not sure whats happening or that I like it >>> >>>>>> [x[-2:] for x in lines] >>> ['12', '42', '49', '56', '25', '36', '49', '64', '81', '00'] >> >> x[-2:] selects all items in the sequence with index i such that len(x) >> - 2 <= i < len(x). For a sequence of length 2 or less, that's the >> entire sequence. > > Thanks -- learn something > So it means that indices can give indexerror; slices cannot? > Seems fair enough put that way, but is visually counterintuitive > Are you seriously trying to say that you teach Python but don't understand a basic that is here https://docs.python.org/3/tutorial/introduction.html, "Slice indices have useful defaults; an omitted first index defaults to zero, an omitted second index defaults to the size of the string being sliced."? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to access the low digits of a list fl <rxjwg98@gmail.com> - 2015-06-02 05:23 -0700
Re: How to access the low digits of a list Joel Goldstick <joel.goldstick@gmail.com> - 2015-06-02 08:32 -0400
Re: How to access the low digits of a list Frank Stutzman <stutzman@cat2.kjsl.com> - 2015-06-02 12:34 +0000
Re: How to access the low digits of a list Rustom Mody <rustompmody@gmail.com> - 2015-06-02 05:35 -0700
Re: How to access the low digits of a list Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-02 08:19 -0600
Re: How to access the low digits of a list Rustom Mody <rustompmody@gmail.com> - 2015-06-03 14:08 -0700
Re: How to access the low digits of a list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-03 22:41 +0100
Re: How to access the low digits of a list Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-03 16:36 -0600
Re: How to access the low digits of a list Steven D'Aprano <steve@pearwood.info> - 2015-06-04 23:27 +1000
Re: How to access the low digits of a list Steven D'Aprano <steve@pearwood.info> - 2015-06-03 01:11 +1000
csiph-web