On Thu, 07 Feb 2013 16:28:17 +1100, Chris Angelico wrote: > On Thu, Feb 7, 2013 at 10:46 AM, Steven D'Aprano > <steve+comp.lang.pyt...@pearwood.info> wrote: >> Dennis Lee Bieber wrote: >>> Though that is the nice feature of REXX*... Anything that wasn't >>> parsable as a REXX statement was automatically sent to the current >>> command processor. >> >> Nice? Are you being sarcastic? What you're describing sounds like a >> classic "Do What I Mean" system, which invariably end up being followed >> by anguished shouts of "Noooo, I didn't mean that!!!". >> >> If you say "Anything that isn't parsable is automatically sent to the >> shell", it doesn't sound too bad. But when you say "Unparseable junk is >> implicitly treated as code and sent off to be executed by something >> which traditionally tends to be forgiving of syntax errors and has the >> ability to turn your file system into so much garbage", it sounds a tad >> less appealing. > > You misunderstand. It's actually a very simple rule. Python follows C's > principle of accepting that any return value from an expression should > be ignored if you don't do anything with it.
Return values are safe. They don't do anything, since they are *being ignored*, not being executed as code. You have to explicitly choose to do something with the return value before it does anything. If C said "if you don't do anything with the return result of an expression, execute it as code in the shell", would you consider that a desirable principle to follow? def oh_my_stars_and_garters(): return "rm -rf /" oh_my_stars_and_garters() > REXX says that any "bare > expression" used as a statement is implicitly addressed to the default > host, which is usually a shell (though I built myself a MUD system where > the default would send text to the client, and shell execution required > ADDRESS CMD "some_command" explicitly); it's very simple and doesn't > feel like a DWIM system at all. Are you saying that Dennis' description of REXX sending unparsable text to the shell for execution is incorrect? -- Steven -- http://mail.python.org/mailman/listinfo/python-list