[ANN] DejaGrabber 0.1 -- search Dejanews with Python

Markus Stenberg mstenber at cc.Helsinki.FI
Mon Jun 28 05:42:28 EDT 1999


duncan at rcp.co.uk (Duncan Booth) writes:
> Nice bit of work. Two comments though:
> Why does get_messages(4) return 5 messages? The doc string implies it 
> should return only as many as its argument.

It's neat, admittedly (I thought of writing one myself the other day, and
then found that one ;->). The first time I need to do some serious Deja
action, I'll be using it :>.

There's some oops in slicing's internal logic at get_messages; following
patch fixed behavior (for me, anyhow). 

Index: DejaGrabber.py
===================================================================
RCS file: /home/fingon/cvs/projects/python/DejaGrabber.py,v
retrieving revision 1.1
diff -u -r1.1 DejaGrabber.py
--- DejaGrabber.py      1999/06/28 09:35:31     1.1
+++ DejaGrabber.py      1999/06/28 09:40:18
@@ -208,6 +208,5 @@
             message_list.extend(l)
         message_list.sort()
         message_list.reverse()
-        if len(message_list) > n:
-            del message_list[n:-1]
+       message_list = message_list[:n]
         return message_list


> It would be useful if a test example was included in a "if 
> __name__=='__main__'" block at the end of the file. At the very least the 
> example you give above, but perhaps more usefully a full command line 
> driven grabber.



-Markus

-- 
I consider "Anthill Inside" to be much more comforting sticker than
"Intel Inside".




More information about the Python-list mailing list