views:

25

answers:

2

I have inherited some code that uses klass instead of PyDev's preferred cls:

def func(klass):
    # do something that doesn't reference klass
    return True

PyDev issues a warning that there is an unused parameter klass, which it wouldn't do if we used the parameter cls.

Is there an easy way to let PyDev know that klass is the same thing as cls?

A: 

The only unused name Pydev doesn't warn about is _.

cls is the name used for the first argument in classmethods, but that doesnt seem to be the case here.

THC4k
A: 

If you're using PyDev's built-in code analysis, go to Preferences > Pydev > Editor > Code Analysis, and switch to the 'Unused' tab. At the bottom is a text field containing a list of variable names to ignore if unused. Add klass to that list and you should be all set.

DNS