'Simplifying an 'if' statement with bool()?

I am a beginner python user. how would I shorten this? my pylint was complaining.

def eat_ghost(power_pellet_active, touching_ghost):
    if power_pellet_active is True and touching_ghost is True:
        return True
    return False


Solution 1:[1]

you don't need to write is True because what this does is check if True is True. You can also return the result of the x and y directly, it is again a boolean value.

def eat_ghost(power_pellet_active, touching_ghost):
    return power_pellet_active and touching_ghost

Solution 2:[2]

if expression evaluates to if bool(expression).

but you should be aware that bool(expression) is not equal to expression is True. bool("any non empty string") is True but "any non empty string" is True is False

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 thinkgruen
Solution 2