[Python-Dev] Python3 "complexity" - 2 use cases

Ben Finney ben+python at benfinney.id.au
Sat Jan 11 07:00:56 CET 2014

"Jim J. Jewett" <jimjjewett at gmail.com> writes:

> > Steven D'Aprano wrote:
> >> I think that heuristics to guess the encoding have their role to play,
> >> if the caller understands the risks.
> Ben Finney wrote:
> > In my opinion, content-type guessing heuristics certainly don't belong
> > in the standard library.
> It would be great if there were never any need to guess.  But in the
> real world, there is -- and often the user won't know any more than
> python does.

That's why I think it's great to have heuristic guessing code available
as a third-party library.

> So when it is time to guess, a source of good guesses is an important
> battery to include.

Why is it important enough to deserve that privilege, over the thousands
of other candidates for the standard library? The barrier for entry to
the standard library is higher than mere usefulness.

>     We should explicitly treat autodetection like time zone data --
>     there is no promise that the "right answer" (or at least the "best
>     guess") won't change, even within a release.

But there is exactly one set of authoritative time zones at any
particular point in time. That's why it makes sense to have that set of
authoritative values available in the standard library.

Heuristic guesses about content types do not have the property of
exactly one authoritative source, so your analogy is not compelling.

 \     “Unix is an operating system, OS/2 is half an operating system, |
  `\    Windows is a shell, and DOS is a boot partition virus.” —Peter |
_o__)                                                        H. Coffin |
Ben Finney

More information about the Python-Dev mailing list