A comp.lang.python code snippet archive?

Michael Hudson mwh21 at cam.ac.uk
Wed Mar 1 10:38:43 CET 2000


Mikael Olofsson <mikael at isy.liu.se> writes:

> The bottom line here is that reserved word detection is far from enough
> to create a useful Python snippet detector. We do need something more. 
> Perhaps it could check for indentation aswell. After all, thats one of 
> the things that is special for Python. 

The tokenize module could be brought to bear.  It'd be slow, and
probably pretty hard to code, but it might work.  I suppose the parser
module would do the same job, but faster.  I was thinking that you'd
just scan through the paragraphs of the posting and marking those that
parsed as Python code.  Not very clever, but it'd probably do 80% of
the job.

Cheers,
M.

-- 
very few people approach me in real life and insist on proving they are
drooling idiots.                         -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list