On Tue, 23 Jan 2018 17:43:18 +0000, bartc wrote: > It wouldn't be a satisfactory way of writing C programs. So, although > I'm not that big a fan of C syntax, it might be better to write C as C, > and Python as Python, to avoid confusion.)
This. The fundamental reality is that `a + b` means different things in C and Python. Even if you limit yourself to integers and not arbitrary values (fractions, lists, strings, etc) the semantics are different: - in C, ints have a fixed number of bits and any addition which ends up out of range is undefined behaviour[1]; - while Python uses BigInts, overflow is impossible, and the only possible error is that you run out of memory and an exception is raised (although the addition can take an indefinite long amount of time). Often the difference doesn't matter... but when it does matter, it *really* matters. [1] If anyone thinks that it is addition with overflow, you are wrong. Some C compilers *may* use overflow, but the language strictly defines it as undefined behaviour, so the compiler can equally choose to set your computer on fire[2] if it prefers. https://blog.regehr.org/archives/213 [2] http://www.catb.org/jargon/html/H/HCF.html -- Steve -- https://mail.python.org/mailman/listinfo/python-list