Per the PEP 8 Style Guide, the preferred ways to compare something
to True are the patterns ifcondisTrue: or ifcond:.
This is only a guideline. It can be ignored if needed.
But the purpose of the PEP 8 Style Guide is to improve the readability of code.

The statement below uses the equality operator to compare a boolean variable to True.
This is not the PEP 8 preferred approach to comparing values to True.
For sure, it is an anti-pattern not only in Python but in almost every programming language.

flag=True# Not PEP 8's preferred patternifflag==True:print("This works, but is not the preferred PEP 8 pattern")

The code below uses the PEP 8 preferred pattern of ifcondition:.
If the type of the condition is Boolean, it is obvious that comparing to True is redundant.
But in Python, every non-empty value is treated as true in context of condition checking,
see Python documentation:

In the context of Boolean operations,
and also when expressions are used by control flow statements,
the following values are interpreted as false:
False, None, numeric zero of all types, and empty strings and containers
(including strings, tuples, lists, dictionaries, sets and frozensets).
All other values are interpreted as true.

This pattern is useful, when you make actual distinction between True value and
every other that could be treated as true.
The same applies to ifcondisFalse.
This expression is true only if cond has actual value of False
- not empty list, empty tuple, empty set, zero etc.