query regarding python script

Peter Hansen peter at engcorp.com
Thu May 20 10:27:04 EDT 2004


Shubhra Gupta wrote:

>>I have the following statement in one my python script :-
>>
>>assert not opt_initialize or os.path.exists(initdir), "initialize implies init directory"
>>
>>Could u tell please what it is intended to do?

Nobody but the author could say what it was *intended* to
do.

What it is actually doing, however, is terminating the program
if the opt_initialize flag is False or, in the case where it's
True, if there is a directory or file (!) with the path in 'initdir'.
If it does terminate the script, it will also show the string that
follows.

The lines shown will also not execute at all if the script is
run with the -O or -OO options.

Looks like it was not entirely well thought out...

-Peter



More information about the Python-list mailing list