[Pythonmac-SIG] Do I need to check array type code for byteswap()?

Bob Swerdlow rswerdlow at transpose.com
Wed Oct 8 15:16:47 EDT 2003

We've got a cross-platform application written in python, using PyObjC and
Cocoa on Mac OS X and PythonCard and wxPython on Windows.  We use
array.array to format some of the stuff that we save in files, and so need
to use array.byteswap() to massage the data so we can read it.

In the documentation at http://python.org/doc/current/lib/module-array.html,
it states that byteswap is only supported for "values which are 1, 2, 4, or
8 bytes in size," yet all of the types listed in the table at the top of the
page ARE one of those sizes.  Is this a "future compatibility" issue or
something?  Do I need to check that the type code is one of those listed or
can I assume that byteswap() is going to work since all of the types are


More information about the Pythonmac-SIG mailing list