[issue24246] mimetypes.guess_extension returns different values when init() is called several times

2015-05-20 Thread Emmanuel Gamby

Changes by Emmanuel Gamby :


--
type:  -> behavior

___
Python tracker 
<http://bugs.python.org/issue24246>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24246] mimetypes.guess_extension returns different values when init() is called several times

2015-05-20 Thread Emmanuel Gamby

New submission from Emmanuel Gamby:

Hi,

Following the principle of least astonishment, I would expect the function to 
return the same value.

Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mimetypes
>>> mimetypes.init()
>>> mimetypes.guess_extension('text/plain') 
'.ksh'
>>> mimetypes.init()
>>> mimetypes.guess_extension('text/plain') 
'.asc'
>>> mimetypes.init()
>>> mimetypes.guess_extension('text/plain') 
'.txt'

It seems that each call overrides the global dictionnary, which changes the 
iteration order of the next call.

Best Regards,
Emmanuel

--
components: Library (Lib)
messages: 243655
nosy: egamby
priority: normal
severity: normal
status: open
title: mimetypes.guess_extension returns different values when init() is called 
several times
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue24246>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com