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

Jack Jansen Jack.Jansen at cwi.nl
Wed Oct 8 17:14:52 EDT 2003

On 8-okt-03, at 21:16, Bob Swerdlow wrote:
> 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
> permitted?

Post a bug report about this: the documentation should be clearer. If 
it would
say "if you try to byteswap() on unsupported values you'll get an 
you know that you don't have to worry.

And practically: I wouldn't worry about it. As the typecode is stored 
with the
array I can't imagine an implementation that would break things on 
without telling you anything.
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 

More information about the Pythonmac-SIG mailing list