In <[EMAIL PROTECTED]>, Qopit wrote:
> Now I'm running into another snag when checking some other code I have.
> Pychecker gets hung up on raw_input... it actually executes code
> rather than just checking it, it seems. For example, the snippet below
> hangs pychecker::
>
> #---
> while 1:
> x = raw_input("meh:")
> #---
>
> Curious.
AFAIK `pylint` tries to avoid running the code.
A common idiom to protect code from being executed, if the module is just
imported opposed to executed as main module, is to write::
def foo():
# some code
if __name__ == '__main__':
foo()
`__name__` is set to the module name if the module will be imported but to
'__main__' if the module is directly executed.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list