does python could support sequence of short or int?

Fuzzyman fuzzyman at gmail.com
Thu Mar 30 05:36:52 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, 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?

A byte sequence in Python is a 'str'. They are immutable, so any
operations that change the object will return a new instance of 'str'.

In Python although we use references to objects, they aren't pointers -
so you don't operate directly on the byte sequence in memory. (Not
using the basic datatypes anyway).

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml




More information about the Python-list mailing list