Message30582
Ctypes version 1.0.1 and Python 2.4:
A Partially declared structure can be used as a type
in its own field declarations:
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more
information.
>>> from ctypes import Structure, c_int, sizeof, __version__
>>> __version__
'1.0.1'
>>> class S(Structure):
... pass
...
>>> S._fields_ = [('i', c_int), ('s', S)]
>>> sizeof(S)
4
>>> o=S(7)
>>> o.s.i=12
>>> o.s.s.i=20
>>> o.i
7
>>> o.s.i
12
>>> o.s.s.i
20
>>> sizeof(o)
4
|
|
Date |
User |
Action |
Args |
2007-08-23 14:49:58 | admin | link | issue1598620 messages |
2007-08-23 14:49:58 | admin | create | |
|