[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] setting + modifying a variable for use across the entire application



ah hold on I misunderstood. I thought mutated was a python keyword or
some reserved function as in __dir__ or something.

But no, you're just creating a new piece of the module.

Sheeeeeooooot why didn't I think of that ...

On Fri, Dec 2, 2011 at 1:22 PM, Sean Wolfe <ether.joe@xxxxxxxxx> wrote:
> ooh 'mutated' ?? that is cool man.
>
> On Fri, Dec 2, 2011 at 1:16 PM, René Dudfield <renesd@xxxxxxxxx> wrote:
>> Arg... one more time with bug fixed.
>>
>>
>>
>> # config.py
>> someconfigvar = "hello"
>>
>>
>> #Then in each module you can just do...
>>
>>
>> # file1.py
>> import config
>> config.mutated = 1
>>
>>
>> #file2.py
>> import config
>> x = config.mutated
>>
>>
>> #file3.py
>> import file1
>> import file2
>>
>> print (file2.x) # should print 1
>
>
>
> --
> A musician must make music, an artist must paint, a poet must write,
> if he is to be ultimately at peace with himself.
> - Abraham Maslow



-- 
A musician must make music, an artist must paint, a poet must write,
if he is to be ultimately at peace with himself.
- Abraham Maslow