Barry Warsaw writes: > On Oct 8, 2009, at 3:29 AM, Glenn Linderman wrote:
> > Headers could possibly be a quadruple instead of a triple, with the > > 4th item being the wire format if received? I think the whole input format (note, not necessarily wire!) should be saved off on the top-level Message object (possibly in a file, per Barry's comments about that). Subobjects could then refer to to pieces of that as position ranges. > I think not a quad. I think other APIs should be used to extract the > raw data, e.g. > > >>> # return a unicode or throw an exception > >>> text = str(header) > >>> # should always be okay even if gibberish > >>> raw = bytes(header) > > or /something/ like that. Does that work? I would think (especially in parallel to text) you want bytes(header) to be the wire format. If so, you want it to raise if it knows it contains gibberish. And again, we have the problem of whether it should return with the field name prepended or just the field body. I have a feeling we should not try to decide what APIs we're going to spell as __str__ and __bytes__ yet. _______________________________________________ Email-SIG mailing list Email-SIG@python.org Your options: http://mail.python.org/mailman/options/email-sig/archive%40mail-archive.com