Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; '+++': 0.03; 'syntax': 0.03; 'value,': 0.03; 'indicated': 0.07; 'matches': 0.07; 'executes': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'scripting': 0.09; 'that).': 0.09; 'translations': 0.09; 'worse': 0.09; 'language,': 0.11; 'language': 0.14; '(note:': 0.16; 'command,': 0.16; 'command;': 0.16; 'editor,': 0.16; 'keywords.': 0.16; 'nightmare': 0.16; 'pipes': 0.16; 'preprocess': 0.16; 'processor,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'unquoted': 0.16; 'value),': 0.16; 'wrote:': 0.17; 'basically': 0.17; 'found,': 0.17; 'fri': 0.17; 'processor': 0.17; 'string,': 0.17; '(in': 0.18; 'shell': 0.18; '(or': 0.18; 'windows': 0.19; 'feb': 0.19; '(not': 0.20; 'variable': 0.20; 'equivalent': 0.20; 'file.': 0.20; 'explicit': 0.22; 'parse': 0.22; 'programming': 0.23; 'originally': 0.23; "python's": 0.23; 'external': 0.24; 'command': 0.24; 'script': 0.24; 'common': 0.26; 'recognized': 0.27; '(as': 0.27; 'ibm': 0.27; 'mix': 0.27; "doesn't": 0.28; 'header:X-Complaints-To:1': 0.28; 'lines': 0.28; 'run': 0.28; "d'aprano": 0.29; 'finds': 0.29; 'implicitly': 0.29; 'invoke': 0.29; 'parent': 0.29; 'statements': 0.29; 'steven': 0.29; "skip:' 10": 0.30; 'fri,': 0.30; 'keyword': 0.30; 'push': 0.30; 'function': 0.30; 'error': 0.30; 'stuff': 0.30; 'code': 0.31; 'file': 0.32; 'switch': 0.32; 'quotes': 0.33; 'url:home': 0.33; 'to:addr:python-list': 0.33; 'text': 0.34; 'done': 0.34; 'whatever': 0.35; 'replaced': 0.35; 'similar': 0.35; 'next': 0.35; 'received:org': 0.36; 'created': 0.36; 'except': 0.36; 'but': 0.36; "didn't": 0.36; 'too': 0.36; 'charset:us-ascii': 0.36; 'editor': 0.37; 'execute': 0.37; 'being': 0.37; 'late': 0.37; 'passed': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'object': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'called': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'end': 0.40; 'easy': 0.60; 'real': 0.61; 'first': 0.61; 'between': 0.63; 'different': 0.63; 'subject:...': 0.63; 'more': 0.63; '2013': 0.84; 'processor.': 0.84; 'dennis': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Opinion on best practice... Date: Fri, 08 Feb 2013 13:29:48 -0500 Organization: > Bestiaria Support Staff < References: <5111b826$0$29969$c3e8da3$5496439d@news.astraweb.com> <5112eb4a$0$29965$c3e8da3$5496439d@news.astraweb.com> <51134e9f$0$21812$c3e8da3$76491128@news.astraweb.com> <511431a3$0$29966$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-253-106-181.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 105 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360348201 news.xs4all.nl 6863 [2001:888:2000:d::a6]:51896 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38473 On Fri, 08 Feb 2013 09:58:42 +1100, Steven D'Aprano declaimed the following in gmane.comp.python.general: > Dennis Lee Bieber wrote: > > > > Line 3 has unquoted "echo" which is not a REXX command; it is > > considered an external command and is passed the /result/ of calling > > REXX time() -- where Windows executes it > > Good lord, that's even worse than I feared. So it's not just unparsable > non-REXX code that is implicitly sent to the shell, but the equivalent to > Python's NameErrors. And you can implicitly mix calls to the shell and REXX > function calls in the same line. > You have to remember -- REXX was not created to be a stand-alone programming language, as Python. It was created (in the late 70s early 80s) to be a "better" "shell" scripting language on IBM mainframes in place of JCL and similar ("shell" in quotes as neither the interactive command line nor submitted batch files were considered to run in "shells"). Being able to transparently make use of the parent command processor (or switching to a different command processor -- have the script preprocess some data files, for example, then invoke the system editor, switch to the editor as command processor, and edit a file based upon what contents are in the preprocessed data). Common practice is to quote the first word of any thing being sent to the command processor -- to make it more explicit and to avoid conflicts with REXX keywords. Hypothetically, if "DO" were the command to invoke some system command (dump object file?): DO sourcefile would generate a syntax error as it doesn't match the REXX "DO" loop syntax (as I recall, I originally indicated that stuff that doesn't parse as a REXX /statement/ was sent to the command -- this parses as a REXX loop with a syntax error); whereas 'DO' sourcefile is a string, and will be sent to the command processor. The emphasis is on "statement". Statements basically fall into keyword blah blah blah or variable = blah blah blah E:\UserData\Wulfraed\My Documents>type test.rx /* */ operation.1 = 'date' operation.3 = 'time' do i = 1 to 4 say operation.i operation.i '/t' end call operation E:\UserData\Wulfraed\My Documents>type operation.4 /* */ say inside "operation.4" E:\UserData\Wulfraed\My Documents>type operation.rx /* */ say inside "operation.rx" E:\UserData\Wulfraed\My Documents>regina test.rx date Fri 02/08/2013 OPERATION.2 'OPERATION.2' is not recognized as an internal or external command, operable program or batch file. 6 *-* operation.i '/t' +++ RC=1 +++ time 01:28 PM OPERATION.4 INSIDE operation.rx E:\UserData\Wulfraed\My Documents> (Note: OPERATION.4 brings up a Windows requester that it doesn't know how to execute that file type -- but the file was found, so no REXX error; the CALL operation finds operation.rx, and executes it as a subprogram) If the line doesn't begin with a keyword or of the form "variable =", then first translations are done for any word in the line that matches a variable or function name (variables are replaced by their value, functions are called and replaced by their return value), and whatever is left of the line is passed to the command processor. If you want the real nightmare -- look into the IBM "queue" scheme (not many REXX implementations except on IBM mainframes support that). One can push lines onto the queue, such that when the script exits, the command processor reads those lines first before reading from keyboard... Or push lots of text in a way that the next script to start reads it without using a temporary file. IBM mainframes didn't "multitask" too well ; no easy creation of processes with pipes between them. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/