Text-mode apps (Was :Who are the "spacists"?)

Steve D'Aprano steve+python at pearwood.info
Sat Apr 1 13:38:57 EDT 2017


On Sun, 2 Apr 2017 03:08 am, Marko Rauhamaa wrote:

> Chris Angelico <rosuav at gmail.com>:
> 
>> On Sun, Apr 2, 2017 at 2:43 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
>>> 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?
> 
> When there's a will, there's a way:
> 
>  * Show a folder icon for a directory and a file icon for a file.

I'm blind, and need a text reader. How do I see your folder icon?

Or more importantly, how do I *input* your folder icon?

Or I'm using a text-only interface, because I'm SSH'ed into the computer
over a 2400 baud modem going through a noisy line.


>  * Do it URI style: path/to/results-Q2%2F2017.json

Wait, I see no slash in the file name. How am I supposed to tell my mum to
open the file "results-Q2/2017.json" when it doesn't display the slash? Do
I have to memorise the hex code for / in some obscure system?

How do I distinguish between results-Q2%2F2017.json and results-Q2/2017.json
if the later displays like the former?


>  * Do it C style: path/to/results-Q2\/2017.json

That can't be right. The file name is supposed to be results-Q2/2017.json,
not results-Q2V2017.json.

You're deliberately trying to make things hard for my dear ole mum, aren't
you? You know she doesn't wear her glasses when reading file names.


>  * Do it Python style: [ "path", "to", "results-Q2/2017.json" ]

You got the path wrong. The directory portion is a single directory called
literally:

["path", "to",

(ending with a space, and don't ask me who named this directory, but they
are legal characters so you have to expect them to be used...) and the
filename portion is actually 

"results-Q2/2017.json" ]

so you actually have to write:

['["path", "to", ', '"results-Q2/2017.json" ]']

My dear ole mum just had a stroke trying to understand that, I hope you're
happy now. You brute.


>  * Do it Lisp style: (path to results-Q2/2017.json)
> 
> I'm sure you can come up with several other workable solutions.

You left the prefix "un" out of that adjective.

But all joking aside, of course you can create a complex, fragile, hard to
use system for escaping the record separator character in file names. Do
you imagine that you're the first person who thought of that?

But what does it buy you? *One more character*.

Or, for Windows, I suppose a dozen or so more characters:

https://support.office.com/en-us/article/Invalid-characters-in-file-or-folder-names-or-invalid-file-types-in-OneDrive-for-Business-64883A5D-228E-48F5-B3D2-EB39E07630FA

Either way, you're creating a world of pain for your users, for buggar all
extra benefit.

But if I could borrow Guido's time machine, I'd go back and convince the
file system people to use ^ as the record separator, rather than slash or
backslash or colon. Caret is *much* less likely to be useful in file names
than forward slash (often used for dates) or colon, or even backslash.

^home^steve^document.txt


I'm sure I'd get used to it in a few years... 

Next: convince keyboard manufacturers to move the caret from SHIFT-6 to a
plain, unshifted key. Buggared if I'm going to hit shift every time I want
to use an absolute path...



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.



More information about the Python-list mailing list