If you have a method that can return different types, pylint gives an error if only some of them don't match.
For example
def get_new_value(value):
if isinstance(value, dict):
return {}
elif isinstance(value, list):
return some_value_that_returns_a_list()
else:
return value
def get_my_value(listval):
value = get_new_value(listval)
value.reverse()
This produces an error with a disclaimer
E1103: 15:get_my_value: Instance of 'dict' has no 'reverse' member (but some types could not be inferred)
but this is really not very helpful. Surely if it can't fully infer the types it shouldn't be flagging errors? Feels like the only thing to do is disable this one.
|
Comments
-
2011/01/05 21:09, written by anonymoose
-
2011/01/06 09:20, written by sthenault
add commentIs there any plans to fix this soon? This message is generating a ton of noise in my output....
This is why you've two different message ids: one when type inference seems ok, another when type inference as missed some stuff. So you can totally disable E1103 in your configuration file to get the behaviour you wish.