using 'global' across source files.

Remco Gerlich scarblac at pino.selwerd.nl
Tue Jan 2 10:15:01 EST 2001


Daniel Klein <danielk at aracnet.com> wrote in comp.lang.python:
> One solution would be to remove the 'global' and pass 'val' as an
> argument, ie,
> 
> def change_val(val):
> 	return val * 2
> 
> 
> import funcs
> val = 100
> funcs.change_val(val)

You mean val = funcs.change_val(val).

I agree that this whole construction with shared globals probably needs some
better design.

-- 
Remco Gerlich



More information about the Python-list mailing list