Are the critiques in "All the things I hate about Python" valid?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Mon Feb 19 05:24:20 EST 2018
On Mon, 19 Feb 2018 09:40:09 +0100, Alain Ketterlin wrote:
> Tim Delaney <timothy.c.delaney at gmail.com> writes:
>
> [...]
>> As others have said, typing is about how the underlying memory is
>> treated.
>
> No. It is much more than that. Typing is about everything you can say
> about a given statement.
"Everything"? Truly *everything*?
Given:
# engage the type system somehow...
# declare a, b, c: non-negative integers
a = abs(int(input("Give me an integer")))
b = a*a
c = (a+1)*(a+1)
can you give me an example of a type-system which is capable of telling
me that:
if (c - b) % 2 == 1:
print("hello world")
else:
fire_missiles()
will never fire the missiles?
I'd be impressed enough with a type system that knew that a%2 was always
0 or 1, although I suppose there could be some that already know that.
Hell, I'd even be impressed if it could tell that c was not zero...
--
Steve
More information about the Python-list
mailing list