*-unpacking (Re: Fun with fancy slicing)
David Eppstein
eppstein at ics.uci.edu
Fri Oct 3 13:16:19 EDT 2003
In article <22cfb.159311$hE5.5365335 at news1.tin.it>,
Alex Martelli <aleax at aleax.it> wrote:
> David Eppstein wrote:
>
> >> In the mean time, it isn't too hard to write a function which does this:
> >>
> >> def first_rest(x):
> >> return x[0], x[1:]
> >
> > Shouldn't that be called cons?
>
> Hmmm, feels more like the 'reverse' of a cons to me -- takes a list
> and gives me the car and cdr...
Well, but it returns an object composed of a car and a cdr, which is
exactly what a cons is...
--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
More information about the Python-list
mailing list