[Python-Dev] Filename as byte string in python 2.6 or 3.0?
Simon Cross
hodgestar+pythondev at gmail.com
Sun Sep 28 01:13:43 CEST 2008
On Sat, Sep 27, 2008 at 7:41 PM, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> As for 3.0, I'd like to argue that the problem is a minor issue. Even
> though you may run into file names that can't be decoded, that happening
> really indicates some bigger problem in the management of the system
> where this happens, and the proper solution (IMO) should be to change
> the system (leaving open the question whether or not Python should
> be also changed to work with such broken systems).
I can't agree here. File handling is a fundamental operation and I
would expect something like:
>>> for fname in os.listdir('.'):
... if os.path.isfile(fname):
... file(fname)
to work for all files. To have to know to put in special handling for
certain corner case filenames or worse to not be able to open some
files at all would be a serious loss. It would also complicate
migrating code correctly to 3.0.
Regardless of whose fault the underlying issue is, someone has to deal
with the problem and if core Python doesn't, each developer who
encounters the problem will have to come up with his/her own solution.
More information about the Python-Dev
mailing list