a possibly foolish question about slices
eppstein at ics.uci.edu
Fri Jun 14 21:08:25 CEST 2002
In article <yu99sn3prbqm.fsf at europa.research.att.com>,
Andrew Koenig <ark at research.att.com> wrote:
> Suppose x is a string or list, and I want to refer to
> a subsequence of x with length n starting at position p.
> under the assumption that this subsequence is entirely
> To do so, I can use x[p:p+n] in all circumstances but one,
> namely when p < 0 and p == -n. Is there a similarly concise
> expression that works even in this special case?
David Eppstein UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/
More information about the Python-list