does python could support sequence of short or int?

bruno at modulix onurb at xiludom.gro
Thu Mar 30 04:44:37 EST 2006


momobear wrote:
> hi, is there a way to let python operate on sequence of int or short?
> In C, we just need declare a point, 

I assume you mean a 'pointer'.

> then I could get the point value,
> just like:
> short* k = buffer, //k is a point to a sequence point of short.
> short i = *k++,
> but python is a dynamic language,
> a = buffer
> i = ? I don't know how to continue, what's a? a seems to be a str?
> 

<meta>
You'd probably get better answers by exposing the problem you're trying
to solve instead of what you think is the solution
</meta>

Anyway, if you want a list if integers, just put integers into a list
and iterate over that list:

buffer = [1, 2, 3, 42]
for i in buffer:
  do_something_with(i)


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list