Using the same name for variables which are in different functions?

Viewed 7816

I've been searching a while for my question but haven't found anything of use. My question is rather easy and straightforward.

Is it preferable or perhaps "pythonic" to use the same name for a certain variable which will appear in different functions, but with the same purpose?

For example:

def first_function():
    pt = win.getMouse() # This waits for a mouseclick in a graphical window.

    if blabla.button.clicked(pt):
        second_function()

def second_function():
    pt = win.getMouse() 

    if whatever.button.clicked(pt):
        third_function()

Does it matter if the variable reference (pt) to win.getMouse() in the second_function() has the same name as the variable in the first_function()? Or should the variable pt in the second function be named something else?

3 Answers
Related