Henk-Jaap Wagenaar added the comment:

To me the documentation doesn't quite look right, in the case of no factory 
being passed, it runs:

    def __getitem__(self, key):
        """Return the keyed message; raise KeyError if it doesn't exist."""
        if not self._factory:
            return self.get_message(key)
        else:
            return self._factory(self.get_file(key))

from the Mailbox base class. The get_message is thus:

    def get_message(self, key):
        """Return a Message representation or raise a KeyError."""
        start, stop = self._lookup(key)
        self._file.seek(start)
        from_line = self._file.readline().replace(linesep, b'')
        string = self._file.read(stop - self._file.tell())
        msg = self._message_factory(string.replace(linesep, b'\n'))
        msg.set_from(from_line[5:].decode('ascii'))
        return msg

where self._message_factory is set to mailbox.mboxMessage.

I am not familiar with this module, so am unsure whether the documentation is 
ill-worded or it is a bug.

----------
nosy: +Henk-Jaap Wagenaar

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31538>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to