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

bartc bc at freeuk.com
Sun Apr 2 07:12:10 EDT 2017


On 01/04/2017 22:35, Marko Rauhamaa wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> there is no way within Python to have a string that can represent two
>> strings, which is what directory separators do.
>
> Really? Try:
>
>    >>> repr(("a", "b"))
>    "('a', 'b')"
>
> There! A string that represents two strings.
>
> Note, however, that Python programs generally don't restrict themselves
> to expressing objects via strings. There are even objects with no string
> representation at all.
>
> A pathname is a list of strings. Python could naturally express it as
> just that:
>
>   [ "usr", "bin", "python3" ]
>
>
> I'm not really proposing any change to the status quo. What's done is
> done. However, I do think it is awkward to ban one particular, very
> common character while allowing all the rest.

Space is quite common as well, especially in titles of things chosen by 
non-technical users. That also needs special treatment.

There are quite a few other characters with special meanings that people 
might want to use. It's not just stroke.

But people, when unrestrained, will /always/ want to do something that 
may not be practical. For example, why bother with the separate concepts 
'filename' and 'file'; just have the file contents /as/ the filename! If 
there are no limits on how long a filename is or what characters it can 
have, then people will take advantage.

Or they will want to use the full path of one file, as the part of the 
filename of another; is each "/" a separator, or part of the embedded path?

Anyway, I'm sure out of the million unicode characters, there must be 
something that /looks/ like a stroke, but isn't a stroke. Just to add to 
the confusion.


-- 
bartc



More information about the Python-list mailing list