You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Possible regression when narrowing using isinstance #16462
Yeah, most likely I did this. Any with type narrowing works quite arbitrary (and it was never really consistent). It actually works for flipped order (i.e. if isinstance(other, self.__class__) and other: ...). I will check if it is easy to make it more consistent (or at least return the old behavior) without causing troubles in other places.
I'm already changing my code to use only the isinstance check. The first clause (other) is redundant since None cannot ever pass the isinstance check anyway. Thanks for all of your other work.
Activity
ilevkivskyi commentedon Nov 11, 2023
Yeah, most likely I did this.
Anywith type narrowing works quite arbitrary (and it was never really consistent). It actually works for flipped order (i.e.if isinstance(other, self.__class__) and other: ...). I will check if it is easy to make it more consistent (or at least return the old behavior) without causing troubles in other places.cmeyer commentedon Nov 11, 2023
I'm already changing my code to use only the
isinstancecheck. The first clause (other) is redundant sinceNonecannot ever pass theisinstancecheck anyway. Thanks for all of your other work.Narrow Any in and_conditional_map (python#21167)