ros2 / design

Design documentation for ROS 2.0 effort
http://design.ros2.org/
Apache License 2.0
218 stars 193 forks source link

map sequence to Python array.array() #217

Closed dirk-thomas closed 5 years ago

dirk-thomas commented 5 years ago

This patch proposes to map (un)bounded sequences of numerics to array.array instead of numpy.ndarray.

An array provides the same interface as a Python list. It only uses memory closer to what the C representation needs (similar even though slightly higher than numpy) and also checks the value range of each item based on the typecode.

dirk-thomas commented 5 years ago

what about char and wchar types?

What are you suggesting for those types? As far as I can see there are no corresponding dtypes / typecodes for these primitives in numpy / array.

As it stands, it looks like we'll end up with a list of them.

Correct.

hidmic commented 5 years ago

Hmm, I initially noticed 'b', 'B' and 'u', but on a second look, it treats the first two as numbers and using 'u' would result on sequence<char> and sequence<wchar> being represented differently. Nevermind my comment.