struct unpack to pre-allocated array?

2009-01-09 Thread Rich Henry
Is there any way to struct.unpack or struct.unpack_from into an existing array.array or similar structure? I am unpacking file data in a loop and i was hoping to find something that performs better than simply unpacking into a new tuple each iteration. Thanks in advance, Rich -- http://mail.python

C API type issue

2008-10-03 Thread Rich Henry
Made a simple little test program as im learning to embed python, have a simple script that just sets x=10.0 in test.py and prints type(x). Python prints that x is a float but PyFloat_Check() returns false. If i removed the check and just force it to print the double value, its correct. Any ideas w