[Python-3000] [Python-Dev] PEP 30XZ: Simplified Parsing

Michael Sparks ms at cerenity.org
Thu May 3 18:06:58 CEST 2007


On Thursday 03 May 2007 15:40, Stephen J. Turnbull wrote:
> Teaching Python-based extraction tools about it isn't hard, just make
> sure that you slurp in the whole argument, and eval it.

We generate our component documentation based on going through the AST
generated by compiler.ast, finding doc strings (and other strings in
other known/expected locations), and then formatting using docutils.

Eval'ing the file isn't always going to work due to imports relying on
libraries that may need to be installed. (This is especially the case with 
Kamaelia because we tend to wrap libraries for usage as components in a 
convenient way) 

We've also specifically moved away from importing the file or eval'ing things 
because of this issue. It makes it easier to have docs built on a random 
machine with not too much installed on it.

You could special case "12345" + "67890" as a compile timeconstructor and 
jiggle things such that by the time it came out the parser that looked like 
"1234567890", but I don't see what that has to gain over the current form. 
(which doesn't look like an expression) I also think that's a rather nasty 
version.

On the flip side if we're eval'ing an expression to get a docstring, there 
would be great temptation to extend that to be a doc-object - eg using 
dictionaries, etc as well for more specific docs. Is that wise? I don't 
know :)


Michael.
--
Kamaelia project lead
http://kamaelia.sourceforge.net/Home


More information about the Python-3000 mailing list