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

Chris Angelico rosuav at gmail.com
Sat Apr 1 17:45:43 EDT 2017

On Sun, Apr 2, 2017 at 7:35 AM, Marko Rauhamaa <marko at pacujo.net> 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.

In the arbitrary sense that you can encode anything in any way and
then treat it as a string, yes, of course you can devise a system that
lets you represent two strings. But you were talking about the nature
of the string literal in Python, and what you have here is not a
string literal - it's a tuple. You do NOT want to allow file names to
be arbitrary code, nor even "something acceptable by
ast.literal_eval"; they should be simple strings. Otherwise, there's
no point even having them - just use file reference numbers (eg
inodes) instead, and force people to select them from a GUI menu every
time they want to work with a file.


More information about the Python-list mailing list