Newbi Q: Recursively reverse lists but NOT strings?

Bruno Desthuilliers bdesth.quelquechose at
Wed Oct 17 00:16:27 CEST 2007

Bruno Desthuilliers a écrit :
> <OT>answering to Dmitri O.Kondratiev<OT>
> def reverse(xs):
>   if xs:
>     return xs
 >   else:
 >     return (reverse (xs[1:])) + [xs[0]]

I meant:

def reverse(xs):
   if not xs:

of course...

<ot mode='private joke>'
  story stargaming, I caught it first this time !-)

More information about the Python-list mailing list