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

Yes.

> 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
included.

> 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...

    thanks,

    jab

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to