The most annoying typo error...

Steven Taschuk staschuk at telusplanet.net
Wed May 7 12:54:23 EDT 2003


[quoted text reflowed]

Quoth Dave Harrison:
  [...superfluous comma at end of assignment makes tuple, not war...]
> IMHO this particular prob is a wart (as I had it describe to me
> when I ran across it by accident).  [...]
> Python's strenght is in not ignoring such problems, but with
> removing them - or so I have always felt.

As I understand it, you'd prefer that e.g.
    x = foo(y),
to be an error.  The only reasonably small change I can see which
would do this would be to make parentheses mandatory for tuples;
then the above would raise a SyntaxError on parsing, and if you
did want a tuple you'd have to do
    x = (foo(y),)

Didn't it used to be this way for one-element tuples?  My memory
may be failing me, but it seems to me I read "you have to do
one-element tuples like this" somewhere.

> [...] But finding a solution would
> be great, if only to save other coders the 12 hours of pain I
> experienced tracking this prob back in a web app where its not
> really obvious where the error is originating from.

There is some question of whether this kind of scenario is
actually common enough to warrant a language change.

-- 
Steven Taschuk                  staschuk at telusplanet.net
"Telekinesis would be worth patenting."  -- James Gleick





More information about the Python-list mailing list