checking if a list is empty
rusi
rustompmody at gmail.com
Sat May 14 03:45:29 EDT 2011
On May 14, 12:39 pm, Steven D'Aprano <steve
+comp.lang.pyt... at pearwood.info> wrote:
> On Thu, 12 May 2011 23:46:12 -0700, rusi wrote:
> > Mathematics has existed for millenia. Hindu-arabic numerals (base-10
> > numbers) have been known for about one millennium
> > The boolean domain is only a 100 years old. Unsurprisingly it is not
> > quite 'first-class' yet: See
> >http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1070.html
> > [Lifted fromhttp://c2.com/cgi/wiki?EqualVsTrueFalse]
>
> Th money-quote as regards using arbitrary objects in truth tests:
>
> [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]
>
> In Python, [1, 2, 3] is another way of writing true, and [] is another
> way of writing false. Similarly with any other arbitrary objects.
Well so is [1,2] another way of writing True
And then we get the interesting result that
(True = True) is False
More information about the Python-list
mailing list