Misleading error message?

Joel Ricker joejava at dragonat.net
Sun Jan 7 19:29:54 EST 2001


    Colin J. Williams wrote in message <3A57CE77.6B1665A at sympatico.ca>...
    [22]+=[int(src + .5) % 7]
    Traceback (SyntaxError: augmented assign to list not possible
    The error appears to be connected with the use of a constant on the lhs,
    as:
    c=[22]
    c+=[2]
    is permitted.

[22] is still a list literal which cannot be assigned to. c[22] is ok
(assuming its in range).

c=[22] just creates a new list, inializing the first entry to 22 and c+=[2]
just appends 2 the end of the list. Nice trick by the way, will have to file
that one away.

Joel

------------------------------------------------------------
Joel Ricker   joejava at dragoncat.net
  Just Another Python Hacker

I have been Perl-Free for 2 Days, 21 Hours, 40 Minutes, and 28 Seconds.






More information about the Python-list mailing list