Search the web
Sign In
New User? Sign Up
perl-python
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Python Doc Problem Example: os.system   Message List  
Reply | Forward Message #100 of 127 |
Python Doc Problem Example: os.system

Xah Lee, 2005-09

today i'm trying to use Python to call shell commands. e.g. in Perl
something like

output=qx(ls)

in Python i quickly located the the function due to its well-named-ness:

import os
os.system("ls")


however, according to the doc
http://www.python.org/doc/2.4/lib/os-process.html the os.system()
returns some esoteric unix thing, not the command output. The doc
doesn't say how to get the output of the command.

by chance someone told me that in python 2.4 the os.system is
supplanted by subprocess.call(), but this isn't mentioned in the doc!

upon finding the new doc location
http://www.python.org/doc/2.4/lib/module-subprocess.html i'm told that
this module replaces:

os.system
os.spawn*
os.popen*
popen2.*
commands.*


interesting. Since i'm not Python expert, i like to look at these. But
the doc gives ample gratis links to OpenSource this or that or links to
remote book i don't really care about, but here there's no link.

Problem summary:

* does not focus on the task users need to do. Instead, the doc is
oriented towards tech geeking.

* does not inform the reader at the right place where a new function is
replacing the old.

* does not provide relevant cross-links. (while provding many
irrelevant links because of OpenSource or Tech Geeking fanaticism)

Solution Suggestion:

* Add examples.

* Add cross-links to relevant modules.

* Mention and add link at the right place supplanted functions.

* Orient the doc to tasks and manifest functionalities. Think like
functional programing: input and output specification, and document
them. This will help focus and precision in the doc. Avoid essay-like
descriptions. Avoid drilling on remotely related tech/unix/C esoterica.
e.g. Do not mention as a documentation how they are implemented.
Mention implementation on the side if necessary. This way, the language
becomes focused as a independent tool (e.g. Mathematica, Java, Scheme,
emacs) (which may provide ample capabilities to interface/connect to
other technologies), instead of heavily intermixed and dependent with a
bunch of other things (unix things: Perl, Apache, shells).

--------------------------------------------------
This article is archive at:
http://xahlee.org/UnixResource_dir/writ/python_doc_os.html


☄



Mon Sep 5, 2005 12:10 am

p0lyglut
Online Now Online Now
Send Email Send Email

Forward
Message #100 of 127 |
Expand Messages Author Sort by Date

Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in...
xah lee
p0lyglut
Online Now Send Email
Sep 5, 2005
12:15 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help