Global variables

Gerhard Häring gerhard.haering at gmx.de
Wed Feb 12 19:40:46 EST 2003


gislan wrote:
> Hi everyone
> 
> I have two questions
> 
> 1. Is there any reason for NOT using globall variables (I know that
> using global variables in i.e. C isn't very good idea. What about
> python?)

Better ask yourself if you have any reason to use a global variable.
If you don't have any, don't use it. Unnecessary global variables (or
singletons, if you want it to sound better ;-) are a bad idea in any
language.

> 2. I want to run other application (using os.system) and 'catch'
> everything it will print on stdin. How can I do this?

You can either use os.popen2/popen3/popen4, the stuff from the popen
module directly or the commands module.

Gerhard
-- 
Favourite database:             http://www.postgresql.org/
Favourite programming language: http://www.python.org/
Combine the two:                http://pypgsql.sf.net/
Embedded database for Python:   http://pysqlite.sf.net/




More information about the Python-list mailing list