http://docs.python.org/lib/module-pickle.html
... concise Python ways of pickling and unpickling
the (0xFF ** N) possible ways of
packing N strings of byte lengths of 0..xFE together ...
Aye, looks like an exercise left open for the student to complete:
pickle.dumps()
S''\np0\n.
Often it helps to ask yourself the question: How would I do this in C? ...
*Not* by using a structure. A structure is fine if the definition is fixed,
or at most has *one* variable sized field at the very end.
http://docs.python.org/lib/module-pickle.html
might be near where I'll find concise
How do I vary the byte offset of a field of a ctypes.Structure?
How do I use the dynamic nature of Python, and (re-)define the data
type after the required size is already known, on a case by case
basis?
\\\
For example, suppose sometimes I receive the value '\x03hi' + \x04bye'
for the struct:
[EMAIL PROTECTED] wrote:
How do I vary the byte offset of a field of a ctypes.Structure?
How do I use the dynamic nature of Python, and (re-)define the data
type after the required size is already known, on a case by case
basis?
\\\
For example, suppose sometimes I receive the value
[EMAIL PROTECTED] schrieb:
How do I vary the byte offset of a field of a ctypes.Structure?
How do I use the dynamic nature of Python, and (re-)define the data
type after the required size is already known, on a case by case
basis?
\\\
For example, suppose sometimes I receive the value
ctypes.sizeof(a) is still zero, as if ctypes.Structure.__init__
fetches a.__class__._fields_ rather than a._fields_
--
http://mail.python.org/mailman/listinfo/python-list
Thomas,
Ouch ouch I must have misunderstood what you meant by use the dynamic
nature of Python, and (re-)define the data type after the required
size is already known, on a case by case basis.
Do you have an example of what you meant? I searched but did not find.
Are those your words?
Yes, to
I see that changing self._fields_ doesn't change ctypes.sizeof(self).
I guess ctypes.Structure.__init__(self) fetches
self.__class__._fields_ not self._fields_.
--
http://mail.python.org/mailman/listinfo/python-list