1 Aug 2009 01:07
Re: standard library mimetypes module pathologically broken?
Jacob Rus <jacobolus <at> gmail.com>
2009-07-31 23:07:34 GMT
2009-07-31 23:07:34 GMT
Brett Cannon wrote:
>>>> * It creates a _default_mime_types() function which declares a
>>>> bunch of global variables, and then immediately calls
>>>> _default_mime_types() below the definition. There is literally
>>>> no difference in result between this and just putting those
>>>> variables at the top level of the file, so I have no idea why
>>>> this function exists, except to make the code more confusing.
>>>
>>> It could potentially be used for testing, but that's a guess.
>>
>> Here's an abridged version of this function. I don’t think there’s any
>> reason for this that I can see.
>>
>> def _default_mime_types():
>> global suffix_map
>> global encodings_map
>> global types_map
>> global common_types
>>
>> suffix_map = {
>> '.tgz': '.tar.gz', #...
>> }
>>
>> encodings_map = {
>> '.gz': 'gzip', #...
>> }
>>
>> types_map = {
>> '.a' : 'application/octet-stream', #...
>> }
(Continue reading)
RSS Feed