Alexander Belopolsky wrote: > In ctypes arrays of different > shapes are represented using different types. As a result, if the object > exporting its buffer is resized, the datatype object cannot be reused, it > has to be replaced.
I was thinking about that myself the other day. I was thinking that both ctypes and NumPy arrays + proposed_type_descriptor provide a way of describing an array of binary data and providing Python-level access to that data. So a NumPy array and an instance of a ctypes type that happens to describe an array are very similar things. I was wondering whether they could be unified somehow. But then I realised that the ctypes array is a fixed-size array, whereas NumPy's notion of an array is rather more flexible. So they're not really the same thing after all. However, the *elements* of the array are fixed size in both cases, so the respective descriptions of the element type could potentially have something in common. My current take on the situation is that Travis is probably right about ctypes types being too cumbersome for what he has in mind. The next best thing would be to make them interoperate: have an easy way of getting a ctypes type corresponding to a given data layout description and vice versa. -- Greg _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com