New submission from Anderson:

Correct me if I'm wrong, the struct module does not work with array of ints, 
floats etc (just work with char in the form of strings). I think it should 
since this are valid elements in C structs. 

More specifically, consider I have this C struct

struct{
 int array[4];
};

I'm forced to do something like this:
  struct.pack('iiii', v1,v2,v3,v4)  #'4i' is just the same as 'iiii'

I would like to do something like this:
  struct.pack('i[4]', [v1,v2,v3,v4])

Of course this is useful if I want to pack with zeros:
  struct.pack('i[4]', [0]*4)

----------
messages: 240610
nosy: gamaanderson
priority: normal
severity: normal
status: open
title: Struct module should acept arrays
type: enhancement
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23933>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to