-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Aug 17, 2007, at 1:22 PM, Martin v. Löwis wrote:
> A library implementing that in Python should certainly use bytes > at the network (stream) side, and strings at the application side. > Even though the format is human-readable, the protocol is byte- > oriented, > not character-oriented. I should point out that the email package does not really intend to operate from the wire endpoints. For example, for sending a message over an smtp connection it expects that something like smtplib would properly transform \n to \r\n as required by RFC 2821. It's a bit dicier on the input side since you could envision a milter or something taking an on-the-wire email representation from an smptd and parsing it into an internal representation. As I'm working on the email package I'm realizing that classes like the parser and generator need to be stricter about how they interpret their input, and that both use cases are reasonable in many situations. Sometimes you want the parser to accept strings, but bytes are not always unreasonable. Similarly with generating output. Internally though, I feel fairly strongly that an email message should be represented as strings, though sometimes (certainly for idempotency) you still need to carry around the charset (i.e. encoding). Headers are an example of this. The email package conflates 8-bit strings and bytes all over the place and I'm trying now to make its semantics much clearer. Ideally, the package would be well suited not only for wire-to-wire and all-internal uses, but also related domains like HTTP and other RFC 2822-like contexts. - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iQCVAwUBRsXw8HEjvBPtnXfVAQIjrAP+LJ5X3CPqYYMpTZHl3WQeMPq1p4SA36yo exM518OJl/10i5DGDCxnwdVylnlQpvKG+wnjNCXSdfEf9O/Fk63tDrpGqlGBNBkx lNGcHl/s2b+vMm8uhkqu0d1wjOo90od8HFtMA3Y1iSsJw73F4/6sZ7XPR6ERd0yU o1EIR1sHuwE= =pE1O -----END PGP SIGNATURE----- _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
