strong/weak typing and pointers

Steven Bethard steven.bethard at gmail.com
Thu Nov 4 17:53:27 EST 2004


Alex Martelli <aleaxit <at> yahoo.com> writes:
> 
[snip example decomposing float representation into mantissa, etc.]
> 
[snip example determining struct type from first few bytes]
>
[snip example decomposing 16 bit error code into two 8 bit error codes]
> 
[snip example determining utf-8 or utf-16 by trying byte stream as both]

Thanks for the examples!

I'm not quite convinced by the decomposition examples or the struct type
example, but the UTF example is definitely convincing.  I can imagine that you
could extend this type of example to any case where you didn't know the actual
type of a struct.  Given this situation, you could try treating the bytes as
each of the possible struct types, and see (heuristically or perhaps with a
machine learning approach) which struct type is most appropriate.

This definitely meets my criterion of treating the same set of bytes as two
different structures, and it's even useful! =)  Thanks!

Steve




More information about the Python-list mailing list