if statements with or w/o else statements

Diez B. Roggisch nospam-deets at web.de
Mon Feb 23 08:39:22 EST 2004


Bart Nessux wrote:

> Should an if statement have a corresponding else statement? Or, is it OK
> to have an if statement by itself. For completeness, it seems the two
> should be together, but from experience I know that a if statement by
> itself works just fine. Below is an example:

Only if you actually have s/t senseful to do in the else. Otherwise you end
up with s/t like this:

if <cond>:
  ...
else:
  pass

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list