Title: Portable and extended type specifiers for array module
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.5
Status: closed Resolution: duplicate
Dependencies: Superseder: Standard type codes for array.array, same as struct
View: 9066
Assigned To: Nosy List: berker.peksag, mark.dickinson, meador.inge, nnemkin, pfalcon, serhiy.storchaka
Priority: normal Keywords:

Created on 2013-03-04 08:26 by nnemkin, last changed 2016-10-05 09:43 by berker.peksag. This issue is now closed.

Messages (3)
msg183425 - (view) Author: Nikita Nemkin (nnemkin) * Date: 2013-03-04 08:26
Currently array module only provides platform-dependent type specifiers.
It would be very nice to have platform-independent specifiers in addition to that, matching the struct module.
For example array('<H') -> an array of little-endian 2-byte integers.

This issue crops up every time when I use array(). Binary data usually comes in some predefined format and a manual matching to native format has to be done (assuming I want to write portable code).

A useful extra would be to support multi-element struct specifiers and present an array of tuples in this case.
For example array('iff') -> an array of tuples (int, float, float) with native types.
msg215759 - (view) Author: Paul Sokolovsky (pfalcon) * Date: 2014-04-08 13:37
See also
msg278115 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-10-05 09:43
This looks like a duplicate of issue 9066.
Date User Action Args
2016-10-05 09:43:55berker.peksagsetstatus: open -> closed

superseder: Standard type codes for array.array, same as struct

nosy: + berker.peksag
messages: + msg278115
resolution: duplicate
stage: needs patch -> resolved
2014-04-13 09:07:53serhiy.storchakasetnosy: + serhiy.storchaka

versions: + Python 3.5, - Python 3.4
2014-04-08 13:37:47pfalconsetnosy: + pfalcon
messages: + msg215759
2013-03-12 00:28:53meador.ingesetstage: needs patch
2013-03-09 02:12:11terry.reedysetnosy: + mark.dickinson, meador.inge
2013-03-04 08:26:17nnemkincreate