I am using PyCharm to write some python code and notice that I run into the following problem quite often:
I write a line of code like this
for item in myList:
Later, I realize that I would like the index of item
as well, so I try to turn that line into this:
for i,item in enumerate(myList):
In order to turn the first line into the second, I put the cursor to the left of item
and type i,
. Then, I put the cursor to the left of myList
and type enu
; by this time, the code-completer suggests that I might want to type enumerate
, which is exactly the behavior that I'm after. When I hit tab to implement the suggested enumerate
, I notice that my line turns into
for i,item in enumerate:
The myList
has been overwritten!
The behavior that I expect is this:
for i,item in enumerate(myList):
with the cursor immediately to the right of either the myList
or the :
.
Is there any way that I could make Pycharm behave according to my expectations?
Just in case it matters, my dev environment is Mac OSX 10.7.5 (Lion)