[EMAIL PROTECTED] wrote:
> I would like to have functions that operate on long strings, 10-100
MB.
> In C I would of course pass a pointer to the string for a quick
> function call.  What is an efficient way to do this in python?
> Cheers,

In Python, *every* expression is a pointer.  This fact is clearest when
you look a C-implemented Python functions (which have parameter types
and return types of PyObject*), or when using mutable types.

>>> class Spam:
...    def __init__(self):
...       self.foo = 0
...
>>> x = Spam()
>>> y = x
>>> y.foo = 17
>>> x.foo
17

Compare this to the C code:

typedef struct {int foo;} Spam;
...
Spam *x, *y;
...
y = x;
y->foo = 17;
printf("%d\n", x->foo);

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to