[Python-projects] pylint: Do not warn about unused arguments on function that always raises?

Maarten ter Huurne maarten at treewalker.org
Thu Mar 26 00:34:17 CET 2009


Hi,

Please consider the following code:

===
try:
	from os import symlink
except ImportError:
	def symlink(src, dst):
		raise OSError('This platform does not support symbolic links')
print symlink
===
W0613:  4:symlink: Unused argument 'src'
W0613:  4:symlink: Unused argument 'dst'

pylint is correct that the arguments are not used. They cannot be omitted 
though because the replacement symlink function must have the same signature 
as the one that could not be imported.

Would it make sense to ignore non-use of arguments on functions that 
unconditionally raise an exception? Or is this case too specific and would 
that approach cause false negatives in practice?

Bye,
		Maarten



More information about the Python-Projects mailing list