Are the critiques in "All the things I hate about Python" valid?

Anders Wegge Keller wegge at wegge.dk
Sun Feb 18 07:45:39 EST 2018


På Sun, 18 Feb 2018 07:34:03 -0500
Richard Damon <Richard at Damon-Family.org> skrev:

> Python is much stronger typed than PHP, because in PHP you can do things 
> like 1 + '2' and get 3, as string values will naturally convert 
> themselves to numbers, Python won't do this. Yes Python will freely 
> convert between numeric types, but I wouldn't say that Python claims to 
> be a language that focuses on numerics.

 Type coercion is not the same as weak typing. Let me stress that the
difference between languages having 1 + 1.23 as a valid construct and
languages having 1 + '1.23' as a valid construct, is merely a design
descision. PHP is fully aware that a string and an integer have different
types, and makes a implicit cast, rather than throw an error. 

-- 
//Wegge



More information about the Python-list mailing list