Is there a better solution to write a while loop that runs forever if the argument is 0 or just runs n times if the argument is an arbitrary n larger 0 than this:
x = options.num # this is the argument (read by Optparse)
if x == 0:
check = lambda x: True
else:
check = lambda x: True if x > 0 else False
while check(x):
print("Hello World")
x -= 1
you can probably combine the lambda into:
check = lambda x: True if x > 0 or options.num == 0 else False
but then you will still have to count down x, unless you put a if before that.