strong/weak typing and pointers

Steven Bethard steven.bethard at
Thu Nov 4 17:55:48 CET 2004

Alex Martelli <aleaxit <at>> writes:
> Suppose for example that you would like your OS to be able to load
> executable code from disk into memory and execute it.  Suppose you would
> like it to be able to read some configuration parameters from disk and
> set its own internal data structures accordingly.  At one level, as it
> goes to disk or comes back from there, you have arrays of bytes.  But in
> memory, you want functions that can be called appropriately (a device
> driver residing in a module) or data structures which, differently from
> an array of byte, DO have structure -- for example, a partition table
> for a disk, with information to specific filesystem drivers as to what
> partition is to be treated in what way.

I'm sorry, I guess I still don't understand this example.  It sounds like you're
just going between untyped (array of bytes) and typed (functions, data
structures, etc.)  I'm not seeing how you're, for example, casting a function to
a data structure, or a data structure of one type to a data structure of another

Anything can (and sometimes should) be treated just as an array of bytes, in an
analogous method to how in an OO language with a base class Object, sometimes
it's appropriate to treat a given instance of a class as an Object, rather than
it's particular subclass of Object.  I wouldn't consider treating function, data
structures, etc. as arrays of bytes (or vice versa) as something that takes
advantage of "weak-typing", but rather something that takes advantage of the
ability to treat data as untyped.

Hopefully this clarified my confusion and when you get a chance, you can try to
explain it to me again?  Thanks,


More information about the Python-list mailing list