Imported globals?

2007-07-27 Thread Valentina Vaneeva
Hi, I'm new to Python and I've found something in its interpreter that I don't quite understand, and I don't really know how to correctly formulate a search query. Here's the question. If we have a file module_a.py with the following content: | #!/usr/bin/env python | | value =

Re: Imported globals?

2007-07-27 Thread Gary Herron
Valentina Vaneeva wrote: Hi, I'm new to Python and I've found something in its interpreter that I don't quite understand, and I don't really know how to correctly formulate a search query. Here's the question. If we have a file module_a.py with the following content: |

Re: Imported globals?

2007-07-27 Thread Valentina Vaneeva
On Jul 27, 2007, at 10:56 PM, Gary Herron wrote: The variable value is global in module_a, and change_value will always refer to that variable. However, in module_b, when you from module_a import value, change_value you have created two new variables global to module_b that

Re: Imported globals?

2007-07-27 Thread star . public
On Jul 27, 1:30 pm, Valentina Vaneeva [EMAIL PROTECTED] wrote: Thank you, Gary, but I still have one question. What happens in the second case? If I add a call to change_value() to module_a, the value in module_b is imported changed. Why? What exactly does the import statement import in my

Re: Imported globals?

2007-07-27 Thread anethema
It seems that in the first case change_value() called in module_b.py ignores the global statement. Is it so? Why? What happens in the second case? I really don't get it. The key is that it doesn't ignore the global statement, but that global specifically points to the variable 'value' in

Re: Imported globals?

2007-07-27 Thread Valentina Vaneeva
Thank you all, guys. I think, now I understand import behavior more :) Cheers, Valia -- http://mail.python.org/mailman/listinfo/python-list