Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32505

Re: Negative array indicies and slice()

Date 2012-10-30 14:21 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: Negative array indicies and slice()
References <508DEA9D.8040702@r3dsolutions.com>
Newsgroups comp.lang.python
Message-ID <mailman.3104.1351632673.27098.python-list@python.org> (permalink)

Show all headers | View raw


Andrew Robinson wrote:
> I can see that the slice() function can pass in arbitrary arguments.
> I'm not sure for lists, which is what the range is applied to, why an 
> argument like "a" would be part of a slice.

Well, in my dbf.py Record class you can use the names of fields as the slice arguments, instead of 
having to remember the offsets.  record['full_name':'zip4'] returns a tuple (or a list, I don't 
remember) of about 13 fields -- this is especially useful as that block of fields might not be in 
the same place in each table.

~Ethan~

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Negative array indicies and slice() Ethan Furman <ethan@stoneleaf.us> - 2012-10-30 14:21 -0700

csiph-web