list and implicit continuation may cause bugs in Python programs
Roman Suzi
rnd at onego.ru
Tue Jul 17 09:13:58 EDT 2001
On Tue, 17 Jul 2001, Toby Dickenson wrote:
> Roman Suzi <rnd at onego.ru> wrote:
>
> >>> 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" ]
> >>>
> >>> 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.
> >>
> >
> >PyChecker is about determining ambiguity, like lint
> >will give you warnings about
> >
> >if (a=b) { };
> >
> >in C code.
>
> Which, as I am sure you know, is no more ambiguous in C than the
> Python fragment above.
It is not ambiguous for the translator. Still lint-like tools could report
such problems as warnings, because it is too easy to make error here.
I even think, that things like:
for i in list:
if cond:
do_something
else:
somethingelse
must be reported. Just like TAB/space mixes.
This will lead to much more readable code.
Sincerely yours, Roman A.Suzi
--
- Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
More information about the Python-list
mailing list