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.

Author Jim.Jewett
Recipients Jim.Jewett, berker.peksag, corona10, gvanrossum, serhiy.storchaka, xtreak
Date 2020-07-28.05:56:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CA+OGgf6wzprMWPiKqwUUGbM-WU7EQDcgbvYUgTqeK7-PyGDmsw@mail.gmail.com>
In-reply-to <1595892108.58.0.891045448425.issue40841@roundup.psfhosted.org>
Content
There are a zillion reasons a filename could be wrong -- but the standard
says to trust the filesystem.  So if it sniffs based on contents, it isn't
quite following the standard.  It is probably still a useful tool, but it
won't be the One Right Way, and it isn't even clear that it should replace
current heuristics.

On Mon, Jul 27, 2020 at 7:22 PM Guido van Rossum <report@bugs.python.org>
wrote:

>
> Guido van Rossum <guido@python.org> added the comment:
>
> Whether the data was retrieved over a network has nothing to do with it.
>
> There are complementary ways of guessing what data you are working with --
> guess based on the filename extension or sniff based on the contents of the
> file (or downloaded data).
>
> There are a zillion reasons why the filename could be a lie -- e.g. a user
> could pick the wrong extension, or rename a file, or a tool could save a
> file using the wrong extension or no extension at all. Then again sometimes
> the contents of the file might not be enough, e.g.
> ```
> foo() // bar
> ```
> is both valid Python and valid JavaScript. :-)
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue40841>
> _______________________________________
>
History
Date User Action Args
2020-07-28 05:56:06Jim.Jewettsetrecipients: + Jim.Jewett, gvanrossum, berker.peksag, serhiy.storchaka, corona10, xtreak
2020-07-28 05:56:06Jim.Jewettlinkissue40841 messages
2020-07-28 05:56:06Jim.Jewettcreate