diff --git a/crates/ruff_linter/src/rules/pycodestyle/rules/type_comparison.rs b/crates/ruff_linter/src/rules/pycodestyle/rules/type_comparison.rs index ed9430b963..3adaef03ab 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/rules/type_comparison.rs +++ b/crates/ruff_linter/src/rules/pycodestyle/rules/type_comparison.rs @@ -18,6 +18,22 @@ use crate::checkers::ast::Checker; /// /// If you want to check for an exact type match, use `is` or `is not`. /// +/// ## Known problems +/// When using libraries that override the `==` (`__eq__`) operator (such as NumPy, +/// Pandas, and SQLAlchemy), this rule may produce false positives, as converting +/// from `==` to `is` or `is not` will change the behavior of the code. +/// +/// For example, the following operations are _not_ equivalent: +/// ```python +/// import numpy as np +/// +/// np.array([True, False]) == False +/// # array([False, True]) +/// +/// np.array([True, False]) is False +/// # False +/// ``` +/// /// ## Example /// ```python /// if type(obj) == type(1):