[Python-Dev] standard library mimetypes module pathologically broken?

Glyph Lefkowitz glyph at twistedmatrix.com
Mon Aug 3 00:36:27 CEST 2009

On Sun, Aug 2, 2009 at 4:17 PM, Jacob Rus <jacobolus at gmail.com> wrote:

> Robert Lehmann wrote:
> > Jacob Rus wrote:
> >> Here is a somewhat more substantively changed version. This one does
> >> away with the 'inited' flag and the 'init' function, which might be
> >> impossible given that their documented (though I would be extremely
> >> surprised if anyone calls them in third-party code)
> > [snip]
> >
> > There seem to be quite a bunch of high-profile third-party modules
> > relying on this interface, eg. Zope, Plone, TurboGears, and CherryPy. See
> > http://www.google.com/codesearch?q=mimetypes.init+lang%3Apython for a
> > more thorough listing.
> >
> > Given that most of them aren't ported to Python 3 yet, I guess, changing
> > the semantics in 3.x seems not-too-bad to me.

No, it's bad.  If I may quote Guido:

So, once more for emphasis: *Don't change your APIs at the same time as
> porting to Py3k!*

Please follow this policy as much as possible in the standard library; the
language transition is going to be hard enough.

Put a different way: please don't change the library unless you're
*also*going to write a 2to3 fixer that somehow updates all calling
code, too.

Ooh, okay.  Well I guess we can’t get rid of those then!

Indeed not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090802/67af7a2e/attachment.htm>

More information about the Python-Dev mailing list