Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5371
| From | rusi <rustompmody@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: checking if a list is empty |
| Date | 2011-05-14 08:47 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <a86edee8-306b-4777-99fb-99895b512ef6@k15g2000pri.googlegroups.com> (permalink) |
| References | (7 earlier) <4dcc785e$0$29980$c3e8da3$5496439d@news.astraweb.com> <d423a455-f14e-4cb4-8744-0a49259c9c86@34g2000pru.googlegroups.com> <4dce31b3$0$29980$c3e8da3$5496439d@news.astraweb.com> <d72b37d6-bf1e-4cec-94e3-88baca894fd9@35g2000prp.googlegroups.com> <mailman.1548.1305380575.9059.python-list@python.org> |
On May 14, 6:42 pm, Chris Angelico <ros...@gmail.com> wrote:
> On Sat, May 14, 2011 at 5:45 PM, rusi <rustompm...@gmail.com> wrote:
> > And then we get the interesting result that
> > (True = True) is False
>
> How does this work? In Python, the = sign is illegal there, and if you
> mean True == True, then it's True (obviously), which is not False.
>
> Chris Angelico
1. = vs ==
Ok to be true to python syntax I should have said (True == True) is
False.
But then the question arises, is the is a python is or an English is?
If its python then that's fine but its just bland code with no
discussion about it.
To say something about it (in English) one would have to say
(True == True) is False is True (where the first is is a python is and
the second an English one).
2. True == True is (obviously) True
Here is the quote (with internal quote from Dijkstra) from Steven that
I was answering:
------------------------------
[Dijkstra quote]
All this changed with the introduction of the two-element
boolean domain {true, false} which provides the vocabulary
needed to assign values to boolean expressions: 3<4 is a
way for writing true, 3>4 is a way for writing false,
whereas the value of x>0 depends on the value of x ...
[end quote]
[Steven quote]
In Python, [1, 2, 3] is another way of writing true, and [] is another
way of writing false. Similarly with any other arbitrary objects. The
only things that bools True and False are good for are:
<snipped>
[end Steven quote]
------------------------
So since
[1,2,3] is one way of writing True (lets call it True3)
and [1,2] is another (call it True2)
then we have True3 == True2 is False
But since according to Steven (according to Python?) True3 *is the
same* as True2
we get
False
= [1,2,3] == [1,2]
= True3 == True2
= True == True
= True
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-07 02:51 +0000
Re: checking if a list is empty Hans Georg Schaathun <hg@schaathun.net> - 2011-05-11 10:02 +0100
Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-11 12:14 +0000
Re: checking if a list is empty Hans Georg Schaathun <hg@schaathun.net> - 2011-05-11 15:05 +0100
Re: checking if a list is empty "D'Arcy J.M. Cain" <darcy@druid.net> - 2011-05-11 10:27 -0400
Re: checking if a list is empty Hans Georg Schaathun <hg@schaathun.net> - 2011-05-11 18:59 +0100
Re: checking if a list is empty alex23 <wuwei23@gmail.com> - 2011-05-11 20:16 -0700
Re: checking if a list is empty Hans Georg Schaathun <hg@schaathun.net> - 2011-05-12 06:20 +0100
Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-11 15:50 +0000
Re: checking if a list is empty Chris Angelico <rosuav@gmail.com> - 2011-05-12 02:05 +1000
Re: checking if a list is empty Hans Georg Schaathun <hg@schaathun.net> - 2011-05-11 18:56 +0100
Re: checking if a list is empty harrismh777 <harrismh777@charter.net> - 2011-05-11 16:13 -0500
RE: checking if a list is empty "Prasad, Ramit" <ramit.prasad@jpmchase.com> - 2011-05-11 13:39 -0400
Re: checking if a list is empty Roy Smith <roy@panix.com> - 2011-05-11 08:26 -0400
Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-11 13:29 +0000
Re: checking if a list is empty Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-12 17:44 +1200
Re: checking if a list is empty Hans Georg Schaathun <hg@schaathun.net> - 2011-05-12 07:06 +0100
Re: checking if a list is empty Roy Smith <roy@panix.com> - 2011-05-12 07:36 -0400
Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-13 00:16 +0000
Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-12 23:46 -0700
Re: checking if a list is empty Chris Rebert <clp2@rebertia.com> - 2011-05-13 01:02 -0700
Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-13 03:58 -0700
Re: checking if a list is empty Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-05-14 14:34 +1200
Re: checking if a list is empty David Robinow <drobinow@gmail.com> - 2011-05-14 10:28 -0400
Re: checking if a list is empty Roy Smith <roy@panix.com> - 2011-05-14 11:04 -0400
Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-14 07:39 +0000
Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-14 00:45 -0700
Re: checking if a list is empty Chris Angelico <rosuav@gmail.com> - 2011-05-14 23:42 +1000
Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-14 08:47 -0700
Re: checking if a list is empty Chris Angelico <rosuav@gmail.com> - 2011-05-15 01:55 +1000
Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-14 10:43 -0700
Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-14 17:29 -0400
Re: checking if a list is empty Ben Finney <ben+python@benfinney.id.au> - 2011-05-15 09:26 +1000
Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-14 19:41 -0700
Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-15 05:07 +0000
Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-15 10:33 -0700
Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-15 17:36 -0400
Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-15 22:56 -0700
Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-16 00:36 +0000
Re: checking if a list is empty harrismh777 <harrismh777@charter.net> - 2011-05-15 20:59 -0500
Re: checking if a list is empty rusi <rustompmody@gmail.com> - 2011-05-15 22:40 -0700
Re: checking if a list is empty harrismh777 <harrismh777@charter.net> - 2011-05-15 20:25 -0500
Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-15 21:57 -0400
Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-14 16:59 -0400
Re: checking if a list is empty Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-15 05:00 +0000
Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-14 16:53 -0400
Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-12 15:37 -0400
Re: checking if a list is empty Terry Reedy <tjreedy@udel.edu> - 2011-05-12 18:00 -0400
csiph-web