Python as a scripting language. Alternative to bash script?

Robert Kern robert.kern at gmail.com
Tue Jun 29 14:44:27 EDT 2010


On 6/29/10 4:06 AM, Jorgen Grahn wrote:
> On Mon, 2010-06-28, John Nagle wrote:
>> On 6/28/2010 7:58 AM, Benjamin Kaplan wrote:
>>> How does a program return anything other than an exit code?
>>
>>      Ah, yes, the second biggest design mistake in UNIX.
>>
>>      Programs have "argv" and "argc", plus environment variables,
>> going in.  So, going in, there are essentially subroutine parameters.
>> But all that comes back is an exit code. They should have had
>> something similar coming back, with arguments to "exit()" returning
>> the results.  Then the "many small intercommunicating programs"
>> concept would have worked much better.
>
> Like others said, you have standard output. sys.stdout for data,
> sys.stderr for human-readable errors and warnings, and the exit code
> for machine-readable errors.
>
>>      C was like that once.  In the 1970s, all you could return was
>> an "int" or a "float".  But that got fixed.
>
> Huh? The C we have today cannot return a float, and not even a full int.
> 0 and 1 work, small integers up to 255 are likely to work, but beyond
> that common systems (Unix) will chop off the high bits.

I think he's talking about C functions now, not programs.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list