Re: Can synopsis (be made to) follow Python impo rts?

Eric Hopper <[email protected]>
Newsgroups gmane.comp.documentation.synopsis
Message-ID <[email protected]>
On Tue, Dec 21, 2004 at 12:54:51PM -0500, Stefan Seefeld wrote:
> Python is an entirely different story, as name lookup is done at
> runtime, and so a static analyzer can't predict what symbols will be
> found when the python processor actually runs the code.

That's not completely true.  Typical patterns of usage in Python allow a
static analyzer to make correct guesses most of the time.  It's very
rare, for example, that anybody causes the name imported with an import
statement to refer to anything other than what the import statement made
it refer to.

> you can process all the python code that is involved. But you won't be
> able to construct something like a callgraph from that, for example,
> as for that you'd have to execute the code (with a modified
> interpreter).

Callgraphs are a little trickier, but I bet it's still possible.
Python's scoping rules are very simple and straightforward.  And while
you can do some very weird things with executing things in odd scopes,
the most common cases are easy to deal with.

Have fun (if at all possible),
-- 
"It does me no injury for my neighbor to say there are twenty gods or no God.
It neither picks my pocket nor breaks my leg."  --- Thomas Jefferson
"Go to Heaven for the climate, Hell for the company."  -- Mark Twain
-- Eric Hopper ([email protected]  http://www.omnifarious.org/~hopper) --
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFByZ1ajtsvlOwvazYRAjANAKDmGB5G505ikf2FiAaC+MIHcWLhMwCfUyPl
h0Tolk5l6GRmbIaTNp/lYeI=
=H7bE
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.