Peng Yu <pengyu...@gmail.com> writes: > Is there is a way to make python check the variables just as the > strict mode in perl. Would somebody let me know what is the python > equivalent to the perl strict mode?
There isn't one, because Python doesn't have the same concept of “unsafe constructs”; in Python, we think more carefully about adding such constructs to the language in the first place :-) and use a process like Python 2 → Python 3 to remove them. You're specifically asking about variables, so I assume you mean the ‘strict vars’ mode to chack variable usage against variable declarations. Python doesn't have those declarations, and doesn't really have “variables” as you might think of them either. So no, there's no such thing in Python. You will probably be interested in static code checkers such as pyflakes <URL:http://pypi.python.org/pypi/pyflakes> which is small and simple, or pylint <URL:http://pypi.python.org/pypi/pylint> which is comprehensive and very customisable. -- \ “It ain't so much the things we don't know that get us in | `\ trouble. It's the things we know that ain't so.” —Artemus Ward | _o__) (1834–1867), U.S. journalist | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list