Re: globals accros modules

2007-01-12 Thread Bruno Desthuilliers
Stef Mientki a écrit : > Bruno Desthuilliers wrote: > >> Stef Mientki a écrit : >> >>> Bruno Desthuilliers wrote: >>> stef a écrit : >> >> (snip) >> > but tell them that they are going to loose all their globals ??? It's a feature. Globals are definitively a BadThing(tm). >>> >>

Re: globals accros modules

2007-01-11 Thread Robert Kern
Stef Mientki wrote: > Bruno Desthuilliers wrote: >> Unless you clearly explain the benefits... Any code relying on the >> existence of a global is: >> 1/ dependent on the existence of this global >> 2/ harder to understand > And you think physicians will believe that ? > And suppose they believe

Re: globals accros modules

2007-01-11 Thread Steve Holden
stef wrote: >> Change a=1 to amodule.a=1 >> If you find yourself doing tricks with the module globals, think about >> redesigning your application. >> > Of course I completely agree with you. > > But ... > if you're moving from MatLab to Python, > and want to show your collegaes, > with how littl

Re: globals accros modules

2007-01-11 Thread Gabriel Genellina
At Thursday 11/1/2007 11:55, stef wrote: >Of course I completely agree with you. > >But ... >if you're moving from MatLab to Python, >and want to show your collegaes, >with how little effort they can reuse all their existing MatLab routines >in Python, >then the global issue is a real pain !! > >Y

Re: globals accros modules

2007-01-11 Thread Stef Mientki
Bruno Desthuilliers wrote: > Stef Mientki a écrit : >> Bruno Desthuilliers wrote: >> >>> stef a écrit : > (snip) You can explain your collegaes, that - the startindex of arrays changes from 1 to 0 - slices are upto, instead of including the final border - indention is thé key >>

Re: globals accros modules

2007-01-11 Thread Bruno Desthuilliers
Stef Mientki a écrit : > Bruno Desthuilliers wrote: > >> stef a écrit : (snip) >>> You can explain your collegaes, that >>> - the startindex of arrays changes from 1 to 0 >>> - slices are upto, instead of including the final border >>> - indention is thé key >>> And tell them about all beautiful t

Re: globals accros modules

2007-01-11 Thread Stef Mientki
Bruno Desthuilliers wrote: > stef a écrit : >> >>> >>> Change a=1 to amodule.a=1 >>> If you find yourself doing tricks with the module globals, think >>> about redesigning your application. >>> >> Of course I completely agree with you. >> >> But ... >> if you're moving from MatLab to Python, >> an

Re: globals accros modules

2007-01-11 Thread Stef Mientki
Bruno Desthuilliers wrote: > stef a écrit : >> >>> >>> Change a=1 to amodule.a=1 >>> If you find yourself doing tricks with the module globals, think >>> about redesigning your application. >>> >> Of course I completely agree with you. >> >> But ... >> if you're moving from MatLab to Python, >> an

Re: globals accros modules

2007-01-11 Thread Bruno Desthuilliers
stef a écrit : > >> >> Change a=1 to amodule.a=1 >> If you find yourself doing tricks with the module globals, think about >> redesigning your application. >> > Of course I completely agree with you. > > But ... > if you're moving from MatLab to Python, > and want to show your collegaes, > with

Re: globals accros modules

2007-01-11 Thread stef
> > Change a=1 to amodule.a=1 > If you find yourself doing tricks with the module globals, think about > redesigning your application. > Of course I completely agree with you. But ... if you're moving from MatLab to Python, and want to show your collegaes, with how little effort they can reuse a

Re: globals accros modules

2007-01-11 Thread alf
Gabriel Genellina wrote: > Change a=1 to amodule.a=1 I have multiple command line programs creating 'a' and amodule using it. Plus some import sequence dependency. So it would not work. Currently the solution in amodule is: import __main__ print __main__.a > If you find yourself doing tricks

Re: globals accros modules

2007-01-10 Thread Gabriel Genellina
At Thursday 11/1/2007 01:11, alf wrote: How can I have global globals without cyclical import? You can't. Globals are module globals. You need to qualify *which* module `a` belongs to. amodule.py: def f(): global a print a main.py: import

globals accros modules

2007-01-10 Thread alf
Hi, executing main.py reulsts in following: [EMAIL PROTECTED] andy]$ python main.py Traceback (most recent call last): File "main.py", line 4, in ? amodule.f() File "/raid/home/andy/amodule.py", line 3, in f print a NameError: global name 'a' is not defined How can I have global