program in interactive mode

John Machin sjmachin at lexicon.net
Mon Dec 27 06:40:27 CET 2004


Mike Meyer wrote:
>
> I've discovered a truly elegant trick with python programs that
> interpret other data.

Q0. Other than what?

> You make them ignore lines that start with # at
> the beginning of the line,

Q1. After the first user accidentally gets a # at the start of a real
data line, a few hundred lines into their file, then what will you do?
Fix your script to detect this error and re-issue your documentation,
emphasising that this is not a general comment convention?

Q2. Then when users 2+ steam up complaining that they have stacks of
files containing lines like "#### Next section is frappenwanger
readings in picoHertz ####", and the script is printing out a whole lot
of what they regard as gobbledegook followed by
"HashmarkAtStartOfOtherThanLineZeroError", and then stopping, what do
you do?

> and accept the name of a file to be
> interpreted as a first argument. Your users can then put
>
> #!/usr/bin/env mycode.py

Q3. Will that work on 'Doze?

Q4. Doesn't that tie their file to your script, or force other scripts
to ignore the first line?

>
> at the top of their files, and then treat their files as normal
> executables. mycode.py has to be on their path; if not, they need to
> plug in the full path to mycode.py.

Q5. For comparison purposes, could you please post an example of what
you regard as a filthy ugly trick?




More information about the Python-list mailing list