A comp.lang.python code snippet archive?

Hans Nowak hnowak at cuci.nl
Tue Feb 29 14:44:14 EST 2000


On 29 Feb 00, at 10:59, Adrian Eyre wrote:

> >> #snippet "mysnippet.py"
> >> #category "Networking"
> >> #description "This does something interesting"
> >> #begin
> >> #!/usr/bin/env python
> 
> > Nice thought, but I don't think it will work. Well, technically: yes.
> > But I think many people are just like me in this respect: I will not
> > always remember to do this. 
> 
> Surely we don't intend to archive *all* snippets in c.l.py. Only ones that
> are meaningful out of the context of the posting, and are
> useful/reuseable. The author of the snippet can decide whether this is the
> case, and only use the above notation if they want it to be included in
> the archive.

It's a nice idea, but I don't think people will do this. I think hardly 
anyone who posts some Python code will think "Oh yeah, this might be added 
to the snippet repository, so I'll add some headers for easy recognition 
and classification." 

Maybe some kind of "Python code detector" could be helpful, if only for a 
first rough scan of all the messages. I have no idea how to do this though. 
(In Perl it's easy, you simply check if the number of $'s is above 
average... <wink>)  Maybe it should look for reserved words like def or 
import? But a snippet is not guaranteed to include those words, and a 
message which does use them is not guaranteed to have Python code. =/
  
Ideas, anyone?


--Hans Nowak (zephyrfalcon at hvision.nl)
Homepage: http://fly.to/zephyrfalcon
You call me a masterless man. You are wrong. I am my own master.




More information about the Python-list mailing list