This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2015年05月20日 12:26 by egamby, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg243655 - (view) | Author: Emmanuel Gamby (egamby) | Date: 2015年05月20日 12:26 | |
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
|
|||
| msg243662 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2015年05月20日 13:37 | |
This is a duplicate of issue 4963. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:17 | admin | set | github: 68434 |
| 2015年05月20日 13:37:29 | r.david.murray | set | status: open -> closed superseder: mimetypes.guess_extension result changes after mimetypes.init() nosy: + r.david.murray messages: + msg243662 resolution: duplicate stage: resolved |
| 2015年05月20日 12:28:52 | egamby | set | type: behavior |
| 2015年05月20日 12:26:21 | egamby | create | |