global variables or inheritence

Thomas Rasmussen simpsons at kom.auc.dk
Wed Apr 26 22:25:18 CEST 2000


>>>>> "Jeff" == Jeff Massung <jmassung at magpiesystems.com> writes:

  >> testprog1.py: import os, sys, string, testprog2 def main(): print
  >> 'hello' myvar = 2 testprog2.second() if __name__ == '__main__':
  >> main()

  Jeff> NOTE: myvar is local to main() (not to the file)

Well I still want to be able to do this....

  >>  testprog2.py: import os, sys, string, testprog1 def second():
  >> print testprog1.myvar if __name__ == '__main__': print 'nope'
  >> 

  Jeff> Also, just as coding practice - you're cirular use of the
  Jeff> files is VERY bad... it can cause many problems (and is
  Jeff> illegal in many languages - I can't believe Python would allow
  Jeff> it). What is your program that you need to do this with? Just
  Jeff> curious.

Well i'm programming a small admin tool, which must use the users
$EDITOR for editing files. This works fine if the EDITOR sysenv is
set, if not, then i want to ask the user which editor he want to use,
and then pass this variable to the module that handles
filemanipulation. This modules is also in another file if it
matters... I must add that this is my first real program made in
python...

/Thomas

-- 
KOM Network student helper

"To alcohol! The cause of - and solution to - all of life's problems!"
-- Homer Simpson



More information about the Python-list mailing list