another puzzled newbie

Chad Netzer cnetzer at sonic.net
Fri Aug 29 13:21:26 EDT 2003


On Fri, 2003-08-29 at 02:44, Andrew MacIntyre wrote:
> 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,).

> > No, I want (-1) the integer.

> I find a little white space makes things more attractive and easier to
> read, ie:
> 
>         shuffler[i] += -1

Right.  In my case, the first version led me to believe that the poster
may have wanted to append a tuple (well, construct a new one with
'+'...).  The second one, with spaces, makes the intent much less
ambiguous at first glance.

-- 
Chad Netzer






More information about the Python-list mailing list