resize content, not type

Carlos Pita <[email protected]> Mon, 25 Jan 2016 23:37:49 -0300
Newsgroups gmane.comp.python.ctypes
Message-ID <CAELgYhcj_bZC8p9ftR-DorFL1pb8rLLkd2fk8Bfv+nahS7H=+A@mail.gmail.com>
Hi all,

for the resize function the ctypes tutorial states:

> Another way to use variable-sized data types with ctypes is to 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.

What does this mean? I tried monkey-patching the __class__ attribute,
also changing the _length_ attribute, but to no avail. This is not
surprising as the relevant length attribute is part of the C-side
object state, which doesn't seem to be exposed to the python API and
won't change just because I changed the type after construction.

Another option is to resize and then create a new array from_address,
but it won't own the memory so it's a problematic approach.

Cheers
--
Carlos

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140