...And you get can get autocompletion in Emacs as well, so there's that. Before you ask, I use jedi.
def function1(x):
variable1 = x+1
return variable1**2
def function2(x):
variable2 = 2*x
return 5+v...
And I get two auto-completion choices: variable1 and variable2, while only variable2 is logical.I used to use the auto-complete package instead, which in some configs (with ac-source-words-in-buffer or ac-source-words-in-same-mode-buffers in the source list) basically tokenize the buffer and provide autocomplete on all words.
I can probably try and dig up the relevant part of my config, but since I'm using prelude as a base now it mostly just works with only a few lines of tweaking in my personal.el -- mostly just virtualenv locations and enabling virtualenv mode with a hook.