Iterable Ctypes Struct

mark.seagoe at mark.seagoe at
Tue Feb 10 21:31:26 EST 2009

I like the ability to access elements of a struct such as with ctypes

What I like about it is there are no quotes needed.

What I don't like about it is that it's not iterable:
>>>for n in myStruct:  <== gives error
>>>    print n

I don't want to force the end user to have preknowledge of the element
Has anyone subclassed ctypes Structure based class to be iterable?
Before a noob starts trying to do this, is it possible?  How to
approach it?


More information about the Python-list mailing list