Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-13 Thread Greg Ewing
R. David Murray wrote: That doesn't make sense to me. str() should return _something_. Well, it might return something like "". But you shouldn't rely on it to give you anything useful for an arbitrary header. -- Greg ___ Python-Dev mailing list Py

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-13 Thread R. David Murray
On Tue, 14 Apr 2009 at 11:28, Greg Ewing wrote: Barry Warsaw wrote: For an Originator or Destination address, what does str(header) return? It should be an error, I think. That doesn't make sense to me. str() should return _something_. --David ___

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-13 Thread Greg Ewing
Barry Warsaw wrote: For an Originator or Destination address, what does str(header) return? It should be an error, I think. -- Greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: ht

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-13 Thread Barry Warsaw
On Apr 10, 2009, at 2:00 PM, Glenn Linderman wrote: If one name has to be longer than the other, it should be the bytes version. Real user code is more likely to want to use the text version, and hopefully there will be more of that type of code than implementations using bytes. Of cours

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-11 Thread cur...@acm.org
FWIW, that is also the way things are done in the pickle/cPickle module. dump/dumps and load/loads to differentiate between the file object and string ways of using that functionality. On Sat, Apr 11, 2009 at 7:41 AM, Chris Withers wrote: > Nick Coghlan wrote: > >> Barry Warsaw wrote: >> >>> Of c

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-11 Thread Greg Ewing
Chris Withers wrote: Nick Coghlan wrote: A similar naming scheme (i.e. msg.headers and msg.headersb) would probably work for email as well. That just feels nasty though :-( It does tend to look like a typo to me. Inserting an underscore (headers_b) would make it look less accidental. -- Gr

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-11 Thread Chris Withers
Nick Coghlan wrote: Barry Warsaw wrote: Of course, one could use message.header and message.bythdr and they'd be the same length. I was trying to figure out what a 'thdr' was that we'd want to index 'by' it. :) In the discussions about os.environ, the suggested approach was to just tack a 'b

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-11 Thread Nick Coghlan
Barry Warsaw wrote: >> Of course, one could use message.header and message.bythdr and they'd >> be the same length. > > I was trying to figure out what a 'thdr' was that we'd want to index > 'by' it. :) In the discussions about os.environ, the suggested approach was to just tack a 'b' onto the e

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-10 Thread Stephen J. Turnbull
Shouldn't this thread move lock stock and .signature to email-sig? Barry Warsaw writes: > >> It does seem to make sense to think about headers as text header > >> names and text header values. > > > > I disagree. IMHO, structured header types should have object values, > > and something lik

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-10 Thread Barry Warsaw
On Apr 10, 2009, at 2:06 PM, Michael Foord wrote: Shouldn't headers always be text? /me weeps PGP.sig Description: This is a digitally signed message part ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/py

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-10 Thread Barry Warsaw
On Apr 10, 2009, at 2:00 PM, Glenn Linderman wrote: If one name has to be longer than the other, it should be the bytes version. Real user code is more likely to want to use the text version, and hopefully there will be more of that type of code than implementations using bytes. I'm not

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-10 Thread Michael Foord
Glenn Linderman wrote: On approximately 4/10/2009 9:56 AM, came the following characters from the keyboard of Barry Warsaw: On Apr 10, 2009, at 1:19 AM, gl...@divmod.com wrote: On 02:38 am, ba...@python.org wrote: So, what I'm really asking is this. Let's say you agree that there are use case

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-10 Thread Glenn Linderman
On approximately 4/10/2009 9:56 AM, came the following characters from the keyboard of Barry Warsaw: On Apr 10, 2009, at 1:19 AM, gl...@divmod.com wrote: On 02:38 am, ba...@python.org wrote: So, what I'm really asking is this. Let's say you agree that there are use cases for accessing a header

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-10 Thread Barry Warsaw
On Apr 10, 2009, at 1:22 AM, Stephen J. Turnbull wrote: Those objects have headers and payload. The payload can be of any type, though I think it generally breaks down into "strings" for text/ * types and bytes for anything else (not counting multiparts). *sigh* Why are you back-tracking?

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-10 Thread Barry Warsaw
On Apr 9, 2009, at 11:59 PM, Tony Nelson wrote: Thinking about this stuff makes me nostalgic for the sloppy happy days of Python 2.x You now have the opportunity to finally unsnarl that mess. It is not an insurmountable opportunity. No, it's just a full time job . Now where did I put

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-10 Thread Barry Warsaw
On Apr 9, 2009, at 11:41 PM, Tony Nelson wrote: At 22:38 -0400 04/09/2009, Barry Warsaw wrote: ... So, what I'm really asking is this. Let's say you agree that there are use cases for accessing a header value as either the raw encoded bytes or the decoded unicode. What should this return: m

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-09 Thread Stephen J. Turnbull
Barry Warsaw writes: > There are really two ways to look at an email message. It's either an > unstructured blob of bytes, or it's a structured tree of objects. Indeed! > Those objects have headers and payload. The payload can be of any > type, though I think it generally breaks down i

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-09 Thread Tony Nelson
At 22:26 -0400 04/09/2009, Barry Warsaw wrote: >There are really two ways to look at an email message. It's either an >unstructured blob of bytes, or it's a structured tree of objects. >Those objects have headers and payload. The payload can be of any >type, though I think it generally breaks do

Re: [Python-Dev] [Email-SIG] Dropping bytes "support" in json

2009-04-09 Thread Tony Nelson
At 22:38 -0400 04/09/2009, Barry Warsaw wrote: ... >So, what I'm really asking is this. Let's say you agree that there >are use cases for accessing a header value as either the raw encoded >bytes or the decoded unicode. What should this return: > > >>> message['Subject'] > >The raw bytes or the