another puzzled newbie

Chad Netzer cnetzer at
Thu Aug 28 08:09:34 CEST 2003

On Wed, 2003-08-27 at 22:09, Elaine Jackson wrote:
> The analogous thing works fine in interactive mode, but when I put it in a
> script, the function singlePass (below) causes a compile-time error.

A SyntaxError perhaps?

> def singlePass(shuffler,preshuffled,postshuffled):
>     postshuffled+=[preshuffled[shuffler[0]]
You forgot a ']' at the end of the line

>     del(preshuffled[shuffler[0]])
You don't need the '(' and ')' here.  del is a keyword, not a function.

>     del(shuffler[0])
>     for i in range(len(shuffler)):
>         shuffler[i]+=(-1)
If you want a tuple here, it should be (-1,).  It needs the comma.
But, since shuffler is a list, you probably really want [-1].

Chad Netzer <cnetzer at>

More information about the Python-list mailing list