Is Python type safe?

Erik Max Francis max at alcyone.com
Tue Mar 16 21:48:38 EST 2004


Carl Banks wrote:

> Here's my guess:
> 
> long i = 0;
> *(short*)&i = 1;
> 
> if (i == 1) { printf("It's whatever one Intel uses.\n"); }
> else { printf("It's the other one.\n"); }

You meant char, not short.

And none of the solutions so far acknowledge the fact that none of these
types have absolute sizes as defined in the Standard.  If I were
conducting the interview, I'd take points off if that weren't at least
acknowledged.

-- 
 __ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/  \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ Love is when you wake up in the morning and have a big smile.
    -- Anggun



More information about the Python-list mailing list