"Terry Reedy" <[EMAIL PROTECTED]> wrote: > I think the important point is this. In Python, objects are > self-identifying bundles of information, which is to say, the bundle > includes knowledge of the which universe of possible bundles the object > comes from, where the universe includes a set of operations. This is > sometimes called RTTI -- run-time type information. This is in contrast > to other languages and signal-processors where information > (bit-patterns) is usually *not* self-identifying, but the universe must > be somehow enforced by a compiler or carried in the context.
This is an important distinction, and it goes even deeper - in some low level code, the "organisation" consists solely of a priori knowledge in the mind of the assembler or C programmer - that is also why it is so difficult to understand machine code - the individual instructions may be well defined, but because there is no obvious context, it is hard to figure out what the original programmer's intentions were. > In C, for > instance, most types cannot have RTTI and RTTI is only required for > unions. Programmers can give structs a type field and that is how > CPython implements PyObjects. Yes, and for some objects, part of that struct is the piece that is effectively the "value" field, and the content of that is what the value is. And here one is faced with the same problem as I pointed to above - if you do not have access to the struct definition (which you don't have at run time), its kind of difficult to figure out where the value is, and you can only access it via the public methods supplied, if any. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list