Python is DOOMED! Again!
Rustom Mody
rustompmody at gmail.com
Mon Feb 2 07:12:35 EST 2015
On Monday, February 2, 2015 at 1:13:30 PM UTC+5:30, Paul Rubin wrote:
> Steven D'Aprano writes:
> > No apples and no oranges aren't the same thing, but if somebody is expecting
> > no apples, and I give them no oranges instead, it would be churlish for them
> > to complain that none of them are the wrong kind of fruit.
>
> https://davedevine.wordpress.com/2011/01/20/the-sartre-joke/
Actually the Sartre joke is more applicable to haskell than it might appear at first blush.
li = [1,2,3] : [Int] -- a monomorphic type
just as
lc = ['a','b','c'] : [Char]
lli = [[1,2],[3]] : [[Int]]
However [] is a polymorphic value ie
[] : [t] -- t is a type variable
And now if we take
tail (tail (tail li))
you get []
just as if you take
tail (tail lli)
However the two '[]-s' are of different types
and so if you try to say append them you will get a Sartre error:
The list of no integers is incompatible with the list of no lists of integers
More information about the Python-list
mailing list