Re: persistant gloabl vars (very newbie) ?

2006-12-28 Thread Stef Mientki
Erik Johnson wrote: but it's still not quit handy # initialization file (init1.py) import time; xx = 44 # main file was print xx x=time.time() # main file should become print init1.xx x=init1.time.time() so even for the standard functions like time I've to include the preceeding

persistant gloabl vars (very newbie) ?

2006-12-27 Thread Stef Mientki
hi all, I'm investigating the possibilities to replace MatLab with Python (+NumPy +SciPy). I'm a very newbie, I just typed my first characters and calculated the sum of 2 and 3 in Python. My application is a Delphi program, for data-acquisition and real-time data analysis. The real-time analysis

Re: persistant gloabl vars (very newbie) ?

2006-12-27 Thread Erik Johnson
Stef Mientki [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there a way to run the initialization code from a script(file) once, to achieve the same effect ? Certainly. This is what Python modules are all about. You should probably read up on those a bit here:

Re: persistant gloabl vars (very newbie) ?

2006-12-27 Thread Piet van Oostrum
Erik Johnson ej at wellkeeper dot com (EJ) wrote: EJ But briefly, probably what you want to do is put some code in a file, say EJ init.py: EJ # init.py EJ X = 3 EJ Y = 5 EJ # A bunch of other stuff EJ And then in your main program, execute EJ from init import * EJ That

Re: persistant gloabl vars (very newbie) ?

2006-12-27 Thread Stef Mientki
other module that has done 'from init import *'. If you want that kind of behaviour it is better to use: 'import init' and refer to the variables as init.X and init.Y so that you can change them. Whether that is a good idea is another matter. There are other reasons for not using the from

Re: persistant gloabl vars (very newbie) ?

2006-12-27 Thread Erik Johnson
but it's still not quit handy # initialization file (init1.py) import time; xx = 44 # main file was print xx x=time.time() # main file should become print init1.xx x=init1.time.time() so even for the standard functions like time I've to include the preceeding module init1 :-(