Experiences/guidance on teaching Python as a first programming language

Steven D'Aprano steve at pearwood.info
Wed Dec 18 08:53:24 CET 2013

On Wed, 18 Dec 2013 01:33:03 +0000, Steven D'Aprano wrote:

>> or just what operation "x + y" is
>> actually going to perform.
> With no operator overloading, that one at least is correct.

Actually, I stand corrected. I was completely mistaken about that. The C 
operation x + y is undefined if the addition overflows. A valid C 
compiler can produce whatever code it damn well feels like in the case of 

Oh, and in case you think that integer overflow in C will always follow 
two's complement semantics, such that INT_MAX+1 = INT_MIN, you are wrong. 
That's not guaranteed either. Clang and gcc have a flag, -fwrapv, to 
force defined behaviour on integer overflow, but that's not part of the C 
standard and not all C compilers will do the same.


More information about the Python-list mailing list