python 2.7.12 on Linux behaving differently than on Windows

Chris Angelico rosuav at gmail.com
Wed Dec 7 10:55:52 EST 2016


On Thu, Dec 8, 2016 at 2:19 AM, BartC <bc at freeuk.com> wrote:
> OK, but you go first: how does a Linux program tell the difference between:
>
>   A B C
>
> which signifies three files, and:
>
>   A B C
>
> which means two files, and an option C? And without using escapes!

The option would be called "-C", which means you need only distinguish
between filenames *that begin with a hyphen* and options. Given that
this is fundamentally ambiguous, the solution has to be at the
application level, and by convention, you can say "-- A B -C" to mean
that these are all file names, or you can put an explicit path on it
"A B ./-C". Does a leading "./" count as an escape?

ChrisA


More information about the Python-list mailing list