Tip for Python users who edit with pydev on Eclipse

C++, C#, Java, PHP, ect...
Post Reply
Cayle
Posts: 272
Joined: Fri Jul 03, 2009 4:45 am

Tip for Python users who edit with pydev on Eclipse

Post by Cayle »

As of version 1.5, pydev warns about unused variables. This is a wonderful feature. Unfortunately, this wonderful feature also triggers on variables only used to iterate for loops. E.g.

Code: Select all

for j in range(0, rowsPerColumn):
There is a tip to get around this on this stack overflow thread.
By default, it looks like PyDev will hide unused variable warnings for any variables that have names beginning with "dummy", "_", or "unused".
So after a bit of refactoring, the pydev is happy with the following code and you will only get warnings about real potential problems.

Code: Select all

for dummyJ in range(0, rowsPerColumn):
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Tip for Python users who edit with pydev on Eclipse

Post by hallsofvallhalla »

sweet thanks for the tip! I occasionally use Python still and I use Eclipse quite a bit for my G1 android development.
Post Reply

Return to “Coding”