list and implicit continuation may cause bugs in Python programs

Andreas Jung andreas at digicool.com
Thu Jul 12 11:07:39 EDT 2001


----- Original Message -----
From: "Roman Suzi" <rnd at onego.ru>
To: <python-list at python.org>
Sent: Donnerstag, 12. Juli 2001 09:00
Subject: list and implicit continuation may cause bugs in Python programs


> FYI:
>
> Do not forget commas:
>
> list =[ "update", "y", "m", "d", "y1", "m1", "d1", "event", "url",
>          "preview" ]
>
> list =[ "update", "y", "m", "d", "y1", "m1", "d1", "event", "url"
>          "preview" ]
>
> Or Python will silently make:
> ['update', 'y', 'm', 'd', 'y1', 'm1', 'd1', 'event', 'urlpreview']
>
> Does PyChecker check for these kind of things?
>

For what reason should it check ? Both is valid Python code. In the second
case 'url' and 'preview' are concatenated. This is dedicated behaviour.

Also the following is correct Python code:

print "url" "preview"
print "url","preview"

So there is no way to determine the programmers intention at this point.

Andreas


============================================================================
====
Andreas Jung
andreas at digicool.com
Digital Creations               "Zope Dealers"
http://www.zope.org






More information about the Python-list mailing list