Is Python type safe?
Nicolas Fleury
nid_oizo at yahoo.com_remove_the_
Tue Mar 16 17:21:11 EST 2004
Roy Smith wrote:
> I was once asked on an interview how I would tell, inside of a C
> program, if I was on a big endian or a small endian machine. I said I'd
> create a union of a long and a char[4], set the long equal to 1, and see
> which char it showed up in. The interviewer looked shocked, thought
> about it for a while, and finally said something like, "yeah, I guess
> that would work".
>
> To this day, I have no idea what other plan he had in mind.
Maybe the guy was thinking about writing to a file, but your way using a
short is the best I know of...
More information about the Python-list
mailing list