On Sat, Apr 1, 2017 at 4:55 PM, Chris Angelico <ros...@gmail.com> wrote: > On Sun, Apr 2, 2017 at 2:43 AM, Marko Rauhamaa <ma...@pacujo.net> wrote: >> Steve D'Aprano <steve+pyt...@pearwood.info>: >> >>> Open your eyes, there is a whole world past the borders of your insular, >>> close-minded little country. 95% of the world is not American, and there >>> are millions of Americans who want to use non-ASCII characters in their >>> file names, even non-Latin characters. >> >> It would be nice to be able to use a / in my file names. Funny enough, >> I'm allowed to use a zillion unprintable characters in my file names but >> no slashes allowed. >> >> Example: >> >> results-Q2/2017.json > > But how do you distinguish between that file, and a file called > 2017.json in a subdirectory called results-Q2?
You could use a PUA code or the replacement character (U+FFFD) as an escape code. I don't think this is possible in Linux or Unix in general because I think POSIX mandates that '/' is reserved. It *may* be possible in Windows if you're creating a custom file system and can get away with requiring users to use \\?\ paths in this case. The system parses the path up to the volume device, so that part cannot use backslash. Beyond that, path parsing is up to file-system device that manages the volume. If the volume is mounted in the object namespace, then the whole path, including the device name, can use forward slash, since that's just a normal name character to the object manager. For example, you can create a device named "My/Device". -- https://mail.python.org/mailman/listinfo/python-list