Open brycepg opened 6 years ago
This sounds reasonable but I wonder if you have any examples were this is needed today? At least right now all the builtin transforms should return just one potential value.
On Wed, Mar 21, 2018 at 2:48 AM Claudiu Popa notifications@github.com wrote:
This sounds reasonable but I wonder if you have any examples were this is needed today? At least right now all the builtin transforms should return just one potential value.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PyCQA/astroid/issues/521#issuecomment-374867761, or mute the thread https://github.com/notifications/unsubscribe-auth/AAa9yLB5q6VHnPZIKznPbPjp-uWzRb0Cks5tghPJgaJpZM4SxNxH .
For example, if a value which inferred to both an instance of ClassA and ClassB was given to isinstance(value, ClassA) is like isinstance to infer [True, False] respectively (I would need to change isinstance inference)
I would like to use this to make conditionals narrow possible types let through to the possible inferred types inside a conditional. This will remove possible false positive no-member in pylint.
What do you think?
Thanks for the example, sounds good! Go for it.
Currently it looks like builtin inference only allows for one inference to be returned (https://github.com/PyCQA/astroid/blob/master/astroid/brain/brain_builtin_inference.py#L121).
If there are multiple possible inferences, currently the builtin result will be
Uninferable
. For future control flow I think it's important that the builtin brain at least support the possibility of multiple inference values.