A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-April/088611.html below:

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

[Python-Dev] [Email-SIG] Dropping bytes "support" in jsonMichael Foord fuzzyman at voidspace.org.uk
Fri Apr 10 20:06:13 CEST 2009
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, glyph at divmod.com wrote:
>>> On 02:38 am, barry at 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 value as either the raw 
>>>> encoded bytes or the decoded unicode.  What should this return:
>>>>
>>>> >>> message['Subject']
>>>>
>>>> The raw bytes or the decoded unicode?
>>>
>>> My personal preference would be to just get deprecate this API, and 
>>> get rid of it, replacing it with a slightly more explicit one.
>>>
>>>   message.headers['Subject']
>>>   message.bytes_headers['Subject']
>>
>> This is pretty darn clever Glyph.  Stop that! :)
>>
>> I'm not 100% sure I like the name .bytes_headers or that .headers 
>> should be the decoded header (rather than have .headers return the 
>> bytes thingie and say .decoded_headers return the decoded thingies), 
>> but I do like the general approach.
>
> 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 course, one could use message.header and message.bythdr and they'd 
> be the same length.
>
>
Shouldn't headers always be text?

Michael

-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4