wasm-demo/demo/ermis-f/python_m/cur/0272

55 lines
2.0 KiB
Plaintext

From: aa8vb at vislab.epa.gov (Randall Hopper)
Date: Mon, 26 Apr 1999 10:42:45 -0400
Subject: "Compiling" scripts before execution ?
Message-ID: <19990426104245.A504861@vislab.epa.gov>
Content-Length: 1821
X-UID: 272
One concern I've been mulling over lately is the potential problem
maintaining Python scripts over time. For example:
1) It's easy to never create (or to sever) a link to a imported symbol
defined in another module, and you may never know it until python
tries to execute the referencing line of script code.
2) If the signature of an imported method changes, and all
references to it in all scripts aren't updated, you may never know
it until Python tries to execute one of these "broken" line of
script code.
I realize with batch scripts, if you're diligent you can write and maintain
exhaustive test code and include it in the modules (Re: Tim's doctest
thread) -- a good idea IMO.
However, I primarily have Python GUI code in mind, where it's not so simple
to automate testing.
What are folks doing to keep this class of errors from being a problem?
Is there a way to "lint" or compile Python code such that it forces symbols
to resolve when seen (possibly disallowing some dynamic symbol definition
available in the language (e.g. adding methods to classes after class
definition).
To take a few examples:
$ python >>> class C: $ python
>>> def F(): ... def M(): >>> class C:
... return G() ... print self ... def M(self):
... ... ... self.RemovedMethod()
>>> >>> ...
>>>
Is there a "Python lint" tool or hidden option (e.g. "-Dstrict_python") that
can turn these into build-time errors of some sort?
Any tips appreciated.
Thanks,
Randall