Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17500
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed6.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.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'slices': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'trailing': 0.09; '(0,': 0.16; '16)': 0.16; 'alex23': 0.16; 'comma': 0.16; 'pid,': 0.16; 'row': 0.16; 'subject:Newbie': 0.16; 'this:': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'subject:list': 0.21; 'subject:Question': 0.21; 'dec': 0.22; 'wrote': 0.22; 'sun,': 0.30; 'quite': 0.32; 'does': 0.32; 'yet': 0.32; 'header:X -Complaints-To:1': 0.33; 'named': 0.33; 'to:addr:python-list': 0.34; 'thank': 0.35; 'but': 0.37; 'using': 0.38; 'received:org': 0.38; 'subject:from': 0.38; 'missing': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'frank': 0.64; '11,': 0.68; 'received:41': 0.71; '14)': 0.84; 'nice,': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | "Frank Millman" <frank@chagford.com> |
| Subject | Re: Newbie Question: Obtain element from list of tuples |
| Date | Mon, 19 Dec 2011 08:46:28 +0200 |
| References | <jclflh$u45$1@news.albasani.net><roy-B739A1.15041318122011@news.panix.com><2c286dea-efba-45d5-85a7-a7503733575a@i6g2000vbe.googlegroups.com> <4eeea8eb$0$11091$c3e8da3@news.astraweb.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; format=flowed; charset="iso-8859-1"; reply-type=original |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | 41-135-99-54.dsl.mweb.co.za |
| X-MSMail-Priority | Normal |
| X-Newsreader | Microsoft Outlook Express 6.00.3790.4657 |
| X-MimeOLE | Produced By Microsoft MimeOLE V6.00.3790.4913 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.3815.1324277206.27778.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1324277206 news.xs4all.nl 6853 [2001:888:2000:d::a6]:56505 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:17500 |
Show key headers only | View raw
"Steven D'Aprano" <steve+comp.lang.python@pearwood.info> wrote in message news:4eeea8eb$0$11091$c3e8da3@news.astraweb.com... > On Sun, 18 Dec 2011 18:35:47 -0800, alex23 wrote: > >> Pre-namedtuple, I used to like using named slices for this: >> >> cPID = slice(19) >> pid = recs[cPID] > > You know, that is an incredibly simple thing and yet it never dawned on > me before now. Thank you for sharing that. > I also like it, but it does not work quite so simply for me. >>> row = tuple(range(20)) >>> cPID = slice(15) >>> pid = row[cPID] >>> pid (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14) >>> This works - >>> row = tuple(range(20)) >>> cPID = slice(15, 16) >>> pid, = row[cPID] # note the trailing comma >>> pid 15 >>> Still nice, but not quite so elegant. Am I missing something? Frank Millman
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Newbie Question: Obtain element from list of tuples HoneyMonster <someone@someplace.invalid> - 2011-12-18 19:41 +0000
Re: Newbie Question: Obtain element from list of tuples Arnaud Delobelle <arnodel@gmail.com> - 2011-12-18 19:49 +0000
Re: Newbie Question: Obtain element from list of tuples Roy Smith <roy@panix.com> - 2011-12-18 15:04 -0500
Re: Newbie Question: Obtain element from list of tuples HoneyMonster <someone@someplace.invalid> - 2011-12-18 20:22 +0000
Re: Newbie Question: Obtain element from list of tuples Roy Smith <roy@panix.com> - 2011-12-18 15:25 -0500
Re: Newbie Question: Obtain element from list of tuples alex23 <wuwei23@gmail.com> - 2011-12-18 18:35 -0800
Re: Newbie Question: Obtain element from list of tuples Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-19 03:00 +0000
Re: Newbie Question: Obtain element from list of tuples "Frank Millman" <frank@chagford.com> - 2011-12-19 08:46 +0200
Re: Newbie Question: Obtain element from list of tuples DevPlayer <devplayer@gmail.com> - 2011-12-19 07:37 -0800
Re: Newbie Question: Obtain element from list of tuples alex23 <wuwei23@gmail.com> - 2011-12-19 19:53 -0800
Re: Newbie Question: Obtain element from list of tuples Chris Angelico <rosuav@gmail.com> - 2011-12-19 07:51 +1100
Re: Newbie Question: Obtain element from list of tuples Roy Smith <roy@panix.com> - 2011-12-18 16:10 -0500
Re: Newbie Question: Obtain element from list of tuples HoneyMonster <someone@someplace.invalid> - 2011-12-18 22:55 +0000
Re: Newbie Question: Obtain element from list of tuples Chris Angelico <rosuav@gmail.com> - 2011-12-19 10:40 +1100
Re: Newbie Question: Obtain element from list of tuples HoneyMonster <someone@someplace.invalid> - 2011-12-20 00:59 +0000
csiph-web