On Sat, 31 Oct 2009 22:48:10 -0500, Peng Yu wrote:

>> Variables in a function are already private.  How can the names in one
>> function be affected by other functions in the same module?
> 
> You misunderstood me.
> 
> If there are multiple functions or classes in a file, when I change
> variables in a function/class, I have to make sure that they are not in
> other functions or classes.

No you don't.

def f(x):
    return x+1

def g(x):
    return x-1


If I choose to refactor f() and change "x" to "y", why do I care about 
the internal variable inside g()?



Oh wait, I get it... you want to do a global search-and-replace over the 
entire file. *face-palm*

If your functions are less than one-screen full, why do you need a global 
replacement? Global replacement risks changing words in docstrings, 
comments etc that it shouldn't.



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

Reply via email to