[Tutor] beginning to code
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Sep 19 05:34:13 EDT 2017
More information about the Python-list mailing list
Tue Sep 19 05:34:13 EDT 2017
- Previous message (by thread): [Tutor] beginning to code
- Next message (by thread): [Tutor] beginning to code
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): [Tutor] beginning to code
- Next message (by thread): [Tutor] beginning to code
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list