[Python-3000] [Python-Dev] Filename as byte string in python 2.6 or 3.0?

Antoine Pitrou solipsis at pitrou.net
Wed Oct 1 16:36:35 CEST 2008


Stephen J. Turnbull <turnbull <at> sk.tsukuba.ac.jp> writes:
> 
> It's usually not "hypothetical"; often, the user knows what it is.
> Why not ask her?  That's what web browsers do, in effect, by providing
> View as Charset commands.

The average user does not even /know/ what a charset is.
Web browsers provide lots of functions, not all of them are meant for average
users (for example they give access to a "Javascript console" and let people 
choose whether they accept TLS v1.0).

> The problem with the strategies that are being proposed is that this
> is an application-level problem, not a Python-level problem.

I don't understand why you think that. If a filename can't be exactly
represented with a valid Unicode sequence, all applications wanting to access
that file are impacted in the same way, and it is likely that the same solution
or workaround can be applied to all applications. This sounds very much like a
Python-level (or at least stdlib-level) problem to me.

> Good web
> browsers allow you to redisplay the document in a different encoding.

Are you suggesting that the solution to the filename problem is to prompt the
user and ask them for a different encoding?

Not only this solution places a burden on the user, relying on them to give
technical information that they may even not understand (let along be able to
retrieve); but it also places a burden on the application developer to code the
corresponding logic (prompt the user / provide an additional configure option /
have a separate path with manual encoding/decoding of filenames).

> Doing more that that is just asking for bug reports that can only be
> closed as "wontfix" or "pebkac".

There are always bug reports due to miscomprehension of an API or mismatching
expectations. I don't think "we want to avoid bug reports" is a good criterion.
What would be a good criterion is "we want to avoid legitimate dissatisfaction".





More information about the Python-3000 mailing list