[FRPythoneers] propagate module variable changes

NICK VERBECK nerdynick at gmail.com
Mon Nov 12 17:40:22 MST 2007

You may need to use a class that holds these values or create a new
variable type that each variable can inherit from. In that class you
can override the variable sets for each of the two variables to modify
both them and the 3rd variable.

You may also look into the borg pattern as a way of do things.

On Nov 12, 2007 4:35 PM,  <erick_bodine at comcast.net> wrote:
> I am dynamically importing a module like the following, made simple for illustrative purposes.
> module1
> =======
> v1a = 'one'
> v1b = 'two'
> v2 = 'values: %s, %s' % (v1a, v1b)
> If I import "module1" and change the value of v1a, I would like that change to propagate to the module.v2 variable.
> My initial idea is to parse the module file, replacing "v1a='one'" with the desired value, saving as 'module_changed.py' and importing 'module_changed' via __import__.  This will work, but feels like an ugly hack.  Any ideas?
> --ERick
> _______________________________________________
> This message sent by the FRPythoneers mailing list.
> Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
> URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers

Nick Verbeck - NerdyNick

More information about the FRPythoneers mailing list