another puzzled newbie

Andrew MacIntyre andymac at bullseye.apana.org.au
Fri Aug 29 05:44:16 EDT 2003


On Fri, 29 Aug 2003, Elaine Jackson wrote:

> | >     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].
>
> No, I want (-1) the integer. My problem is that I really dislike the appearance
> of a statement like X-=Y. (Even right now I can barely stand writing it.) So I
> wrote X+=(-Y) instead. Maybe it would look better as shuffler=map(lambda n: n-1,
> shuffler)?

I find a little white space makes things more attractive and easier to
read, ie:

        shuffler[i] += -1

YMMV...

Regards,
Andrew.

--
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  (pref) | Snail: PO Box 370
        andymac at pcug.org.au             (alt) |        Belconnen  ACT  2616
Web:    http://www.andymac.org/               |        Australia





More information about the Python-list mailing list