On Sun, Apr 2, 2017 at 7:35 AM, Marko Rauhamaa <ma...@pacujo.net> wrote: > Chris Angelico <ros...@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. ChrisA -- https://mail.python.org/mailman/listinfo/python-list