This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients dabeaz, pitrou, skrah
Date 2012-09-14.16:42:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20120914164203.GA6660@sleipnir.bytereef.org>
In-reply-to <1347639577.63.0.484657410971.issue15944@psf.upfronthosting.co.za>
Content
The decision was made in order to be able to cast back and forth between
known formats. Otherwise one would be able to cast from '<d' to 'B'
but not from 'B' to '<d'.

Python 3.4 will have support for all formats in struct module syntax,
but all non-native formats will be *far* slower than the native ones.

You can still pack/unpack directly using the struct module:

>>> import ctypes, struct
>>> d = ctypes.c_double()
>>> m = memoryview(d)
>>> struct.pack_into(m.format, m, 0, 22.7)
>>> struct.unpack_from(m.format, m, 0)[0]
22.7
History
Date User Action Args
2012-09-14 16:42:23skrahsetrecipients: + skrah, pitrou, dabeaz
2012-09-14 16:42:02skrahlinkissue15944 messages
2012-09-14 16:42:01skrahcreate