How to detect typos in Python programs
Ganesan R
rganesan at myrealbox.com
Tue Jul 29 08:20:44 EDT 2003
>>>>> "Peter" == Peter Hansen <peter at engcorp.com> writes:
> You don't understand the dynamic nature of Python if you
> think this is something that is either easy or 100% reliable.
> Very contrived but instructive example:
> def func(x):
> pass
> import sys
> setattr(sys, 'ab' + 'ost', func)
> stick-that-in-your-static-analyzer-and-smoke-it-ly y'rs
The dynamic nature of Python is definitely a problem but there are some
obvious workarounds. For example a static analyzer can take an option that
says "assume standard modules are not modified". This is probably good
enough for 90% of the cases.
Ganesan
--
Ganesan R
More information about the Python-list
mailing list