Hi, Robert Bradshaw wrote: > On Mar 9, 2008, at 4:23 AM, Dag Sverre Seljebotn wrote: > Fortunately for us, the parse tree follows the python grammar very > closely, which is pretty static. This (plus a bit of extras like > coercion and type declarations) is very close to what we would like > to expose. The most brittle part is making new nodes (e.g. one has to > know exactly all the right attributes).
If it's only for a public plugin API, we could hide the real tree classes behind factory functions in a separate module that would have the same name as the tree nodes, but that would use explicit keyword arguments. That way, you will at least know when you pass an unsupported keyword, and you can generate epydoc documentation for the public API. The only problem I see is that you couldn't just say "isinstance(node, MyFactoryNode)" (MyFactoryNode being the factory function here). But hacking something in the line of "MyFactoryNode.isinstance(node)" isn't that bad either, is it? Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
