79094468

Date: 2024-10-16 14:20:29
Score: 1.5
Natty:
Report link

why checking if x is True is worse

because the code should be written a way which eases modifications.

Checking for x is True works fine when x is an instance of bool, but if you'll want to modify it – for example, create a class for lazy calculation of x, and define it via that class instead of direct assignment, x is True will become false, even if x == True still could be true (see __bool__(), __nonzero__()*, __eq__() and __ne__() on how to achieve that).

Reasons:
  • Blacklisted phrase (1): how to achieve
  • Has code block (-0.5):
  • Starts with a question (0.5): why
  • Low reputation (0.5):
Posted by: LogicDaemon