[Python Wpg] remove dup mails

Peter O'Gorman peter at pogma.com
Wed Oct 31 22:37:08 EDT 2007


Stuart Williams wrote:
> One more thought, not Python-related.  Wouldn't msg['Message-id']
> reliably replace the hash as a unique handle on the message?

I considered that, but, did not trust that the Message-id was, in fact,
a unique message identifier. I don't know enough about email.

> 
> On 10/31/07, Stuart Williams <stuartw at mts.net> wrote:
>> This looks great!  I can't think of significantly better ways of doing
>> it.  Here are some style suggestions.
>>
>> Follow PEP 8 (http://www.python.org/dev/peps/pep-0008/) for
>> indentation, etc.  Note that __delitem__ is a special name, intended
>> to implement dicts, so see how I used it below (untested).  Also, file
>> is one of the  objects that follows the new context management
>> protocol which allows you to use it with "with" a la
>> http://docs.python.org/whatsnew/pep-343.html and get rid of the try
>> and both closes.  Lastly dict's support the "in" operator.

Thank you for the review and pointers.

>>
>> So here's a slightly different version:
>>     for fname in files:
>>         with open(os.path.join(root,fname)) as fobj:

I'm going off to read about 'with' right now!

Peter



More information about the Winnipeg mailing list