[Spambayes] Eliminating duplicates from mbox file

Skip Montanaro skip at pobox.com
Fri Mar 7 22:36:38 EST 2003


    >>> 2. Why did I have to subclass mailbox.PortableUnixMailbox?

    Tim> You shouldn't have to, and you shouldn't have to check for "msg is
    Tim> None" either.  Note that some of the earliest scripts in the
    Tim> codebase don't do either.  For example, from split.py:

    Skip>         mbox = mailbox.PortableUnixMailbox(infp, mboxutils.get_message)
    Skip>         for msg in mbox:
    Skip>             if random.random() < percent:
    Skip>                 outfp = bin1out
    Skip>         ...

    Skip> Yeah, I know.  That's how I originally wrote it.  Without the test
    Skip> against None it just went into an infloop.

Yuck, badly worded.  I should have said something like

    Yeah, I know.  That's how I originally wrote it.  After subclassing
    PortableUnixMailbox to get the "for msg in mbox:" to succeed, without
    the test against None in the loop it just went into an infloop.

Skip



More information about the Spambayes mailing list