On Tue, 19 Sep 2017 17:46:32 +1000, Chris Angelico wrote:

> # Display booleans differently if x is True:
>     ... display flag
> else:
>     ... display number
> 
> which would be better represented with "if isinstance(x, bool):"

Given that True is a singleton, it is redundant to write

if isinstance(x, bool) and x:


I'd write "if x is True" if I really, honestly wanted True specifically.



-- 
Steven D'Aprano
“You are deluded if you think software engineers who can't write 
operating systems or applications without security holes, can write 
virtualization layers without security holes.” —Theo de Raadt
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to