Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16271
| References | <4ed15825$0$21841$426a34cc@news.free.fr> <4ed16fb9$0$29988$c3e8da3$5496439d@news.astraweb.com> <4ed1959d$0$690$426a74cc@news.free.fr> |
|---|---|
| Date | 2011-11-27 12:50 +1100 |
| Subject | Re: Pragmatics of the is operator |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3063.1322358656.27778.python-list@python.org> (permalink) |
On Sun, Nov 27, 2011 at 12:42 PM, candide <candide@free.invalid> wrote: > So, for the same reason, wouldn't it be better to use "if spam is True" > against to "if spam == True" (or better "if spam") ? > They're quite different. "if spam" will check the truthiness of spam - it's equivalent to "if bool(spam) is True"; "if spam is True" checks that it's actually a boolean. But I would recommend against the "== True" form, as it's unclear which form you meant to use. (Others may disagree.) ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Pragmatics of the standard is() function candide <candide@free.invalid> - 2011-11-26 22:20 +0100
Re: Pragmatics of the standard is() function Roy Smith <roy@panix.com> - 2011-11-26 16:32 -0500
Re: Pragmatics of the standard is() function Chris Angelico <rosuav@gmail.com> - 2011-11-27 09:22 +1100
Re: Pragmatics of the standard is() function Alexander Kapps <alex.kapps@web.de> - 2011-11-26 23:38 +0100
Re: Pragmatics of the standard is() function Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-26 23:01 +0000
Re: Pragmatics of the is operator candide <candide@free.invalid> - 2011-11-27 02:42 +0100
Re: Pragmatics of the is operator Chris Angelico <rosuav@gmail.com> - 2011-11-27 12:50 +1100
Re: Pragmatics of the is operator Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-27 03:13 +0000
Re: Pragmatics of the standard is() function Den <patentsvnc@gmail.com> - 2011-11-28 11:22 -0800
Re: Pragmatics of the standard is() function Ethan Furman <ethan@stoneleaf.us> - 2011-11-28 12:05 -0800
Re: Pragmatics of the standard is() function alex23 <wuwei23@gmail.com> - 2011-11-28 19:58 -0800
Re: Pragmatics of the standard is() function Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-29 08:41 +0000
Re: Pragmatics of the standard is() function Den <patentsvnc@gmail.com> - 2011-11-29 09:11 -0800
Re: Pragmatics of the standard is() function Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-11-28 13:57 +0100
csiph-web