Python Forum

Full Version: coming up with a sentinel string for file names
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i am designing a few commands which need to have 2 lists of file or directory names. what i need to come up with is some string that is reasonable to use as a sentinel to indicate where the 1st list ends on the command line and the 2nd list ends. the sentinel marker is not part of either list. this string needs to be something easy to enter on an interactive shell, possible to code in all scripting languages that can run commands, and unlikely to be a used file system object name. one possible marker is "--" that many unix commands already use to end options. but i was thinking of using ",". are there any better ideas?
You could use repeatable switches like -I in gcc. The CLI tools of the plumbum module implement this. You can write
Output:
./example.py -I/foo/bar -I/usr/include
i really don't want to type in something more than each name or path by itself. my latest thought is to use "//" as the separator.
Why not use a word such as then?
Output:
mycommand spam.py eggs.txt tmp/bacon.c then ../bar foo.sqlite /tmp/qux
If a file is named then, one can use "then" in a list.

EDIT: thinking again, "then" is not a good idea because it is a reserved word in Bash. Why not "also"?
Output:
mycommand spam.py eggs.txt tmp/bacon.c also ../bar foo.sqlite /tmp/qux
or maybe "..."?