list and implicit continuation may cause bugs in Python programs

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Jul 17 10:23:10 EDT 2001


Tue, 17 Jul 2001 17:13:58 +0400 (MSD), Roman Suzi <rnd at onego.ru> pisze:

> Still lint-like tools could report such problems as warnings,
> because it is too easy to make error here.

Things which are warned about should be easily rewritable in a way
which doesn't provoke warnings, otherwise warnings will be annoying
sometimes.

For example C compilers and tools which warn about "while (a = f())"
typically don't warn about "while ((a = f()))". Badly mixed tabs and
spaces can always be fixed too.

> I even think, that things like:
> 
> for i in list:
>   if cond:
>     do_something
> else:
>   somethingelse
> 
> must be reported.

But how to rewrite it? I'm not sure if I like this:

  for i in list:
    if cond:
      do_something
    else:
      pass
  else:
    somethingelse

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list