name space problem

BBands bbands at
Wed Oct 24 04:34:38 CEST 2007

On Oct 23, 4:20 pm, at wrote:
> Hello. Indeed the doStuff function in the doStuff module can't do 'a.b
> = 0' (the double dot was just a typo, right?)


> because it doesn't know anything about an object named a.

I was trying to understand why it worked when written in, but not when

> I think the right solution would be not to use 'a' as a global
> variable, but rather to pass it as an explicit parameter to the
> function.

Does doing this make a copy of a?

> In module doStuff:
> def doStuff(a):
>     # some calcs
>     a.b = 0
> In the main module:
> import doStuff
> # ...
> doStuff.doStuff(a)

In my real ap a is quite large...



More information about the Python-list mailing list