Skip Montanaro wrote:
Pylint doesn't catch that I have shadowed the argument msg.  Since
that shadowing happened in an except clause it went unexecuted (and
thus undetected) for a long time.

It seems to me that formal function parameters are about as important
as globals.  Any chance of coaxing pylint into warning about shadowing
parameters?

When do you shadow a formal parameter?

My first intuition would be when you assign a new value to it.

However, that means that you get three warnings in the code below:

def f(x = None):
  if x is None:
    x = []

  x = x + x

  y = x
  x = y + y

  return x

Do you have a better definition for detecting unwanted shadowing?



Albert
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to