Re: [Python-Dev] Patch for an initial support of bytes filename in Python3
Victor Stinner <victor.stinner@haypocalc.com> wrote:
- listdir(unicode) -> only unicode, *skip* invalid filenames (as asked by Guido)
Is there an option listdir(bytes) which will return *all* filenames (as byte sequences)? Otherwise, this seems troubling to me; *something* should be returned for filenames which can't be represented, even if it's only None. Bill
On Tue, Sep 30, 2008 at 8:47 AM, Bill Janssen <janssen@parc.com> wrote:
Victor Stinner <victor.stinner@haypocalc.com> wrote:
- listdir(unicode) -> only unicode, *skip* invalid filenames (as asked by Guido)
Is there an option listdir(bytes) which will return *all* filenames (as byte sequences)? Otherwise, this seems troubling to me; *something* should be returned for filenames which can't be represented, even if it's only None.
Yes, os.listdir() becomes polymorphic -- if you pass it a pathname in bytes the output is in bytes and it will return everything exactly as the underlying syscall returns it to you. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
Guido van Rossum <guido@python.org> wrote:
On Tue, Sep 30, 2008 at 8:47 AM, Bill Janssen <janssen@parc.com> wrote:
Victor Stinner <victor.stinner@haypocalc.com> wrote:
- listdir(unicode) -> only unicode, *skip* invalid filenames (as asked by Guido)
Is there an option listdir(bytes) which will return *all* filenames (as byte sequences)? Otherwise, this seems troubling to me; *something* should be returned for filenames which can't be represented, even if it's only None.
Yes, os.listdir() becomes polymorphic -- if you pass it a pathname in bytes the output is in bytes and it will return everything exactly as the underlying syscall returns it to you.
What about everything else? For instance, if I call os.path.join(<bytes>, <bytes>), I presume I get back a <bytes> which can be passed to os.listdir() to retrieve the contents of that directory. Bill
On Tue, Sep 30, 2008 at 10:41 AM, Bill Janssen <janssen@parc.com> wrote:
Guido van Rossum <guido@python.org> wrote:
On Tue, Sep 30, 2008 at 8:47 AM, Bill Janssen <janssen@parc.com> wrote:
Victor Stinner <victor.stinner@haypocalc.com> wrote:
- listdir(unicode) -> only unicode, *skip* invalid filenames (as asked by Guido)
Is there an option listdir(bytes) which will return *all* filenames (as byte sequences)? Otherwise, this seems troubling to me; *something* should be returned for filenames which can't be represented, even if it's only None.
Yes, os.listdir() becomes polymorphic -- if you pass it a pathname in bytes the output is in bytes and it will return everything exactly as the underlying syscall returns it to you.
What about everything else? For instance, if I call os.path.join(<bytes>, <bytes>), I presume I get back a <bytes> which can be passed to os.listdir() to retrieve the contents of that directory.
Yeah, Victor's code at http://bugs.python.org/issue3187 (file python3_bytes_filename.patch) does this. More needs to be done but it's a start. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (2)
-
Bill Janssen -
Guido van Rossum