[Tutor] put?

Marc Tompkins marc.tompkins at gmail.com
Fri May 2 07:00:18 CEST 2008


On Thu, May 1, 2008 at 4:02 PM, bob gailer <bgailer at gmail.com> wrote:

> Marc Tompkins wrote:
> >
> > In contrast, this line runs a command that returns two values
> >
>
> No No. Python does not have "commands" and can't therefore "run" them.
>
> A better way to express that is: on the right of the = is an expression
> which Python evaluates.


a)  Yes, of course, you're right, my semantics were all wrong.  Serves me
right for ranting before finishing my coffee.

b)  However, you're being a bit dogmatic, dontcha think?  From the
documentation:
*popen*( command[, mode[, bufsize]]) Open a pipe to or from command. The
return value is an open file object connected to the pipe, which can be read
or written depending on whether mode is 'r' (default) or 'w'. The
bufsizeargument has the same meaning as the corresponding argument to
the built-in
open() function. The exit status of the command (encoded in the format
specified for wait()) is available as the return value of the close() method
of the file object, except that when the exit status is zero (termination
without errors), None is returned. Availability: Macintosh, Unix, Windows.

The subprocess module provides more powerful facilities for spawning new
processes and retrieving their results; using that module is preferable to
using this function.

Changed in version 2.0: This function worked unreliably under Windows in
earlier versions of Python. This was due to the use of the _popen() function
from the libraries provided with Windows. Newer versions of Python do not
use the broken implementation from the Windows libraries.
Ease up, Bob.


-- 
www.fsrtechnologies.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080501/dbd17db5/attachment.htm>


More information about the Tutor mailing list