Re: Embedding Python - Passing by Reference

2007-11-29 Thread andy
Thanks for the replies - I see that I completely misunderstood "passing by reference" when discussing Python. It looks like wrapping the object up in a list will be the path I go down as it remains closer to the C API I am wrapping. Thanks again! Andy -- http://mail.python.org/mailman/listinfo/p

Re: Embedding Python - Passing by Reference

2007-11-29 Thread Neil Cerutti
On 2007-11-29, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I understand the parameters to Python functions are passed by > reference: > > def foo(a): > a = a + 1 > > Will change the value of a in the calling function. How do I > implement the equivalent in C when extending Python? You've got

Re: Embedding Python - Passing by Reference

2007-11-29 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I understand the parameters to Python functions are passed by reference: Nope. Python's name-object model is so far different from the named memory block model of Fortran/C/etc that terms invented for the latter are misleading when

Re: Embedding Python - Passing by Reference

2007-11-29 Thread Jean-Paul Calderone
On Thu, 29 Nov 2007 14:39:52 -0800 (PST), [EMAIL PROTECTED] wrote: >I understand the parameters to Python functions are passed by >reference: > >def foo(a): > a = a + 1 > >Will change the value of a in the calling function. How do I implement >the equivalent in C when extending Python? You misund

Embedding Python - Passing by Reference

2007-11-29 Thread andy
I understand the parameters to Python functions are passed by reference: def foo(a): a = a + 1 Will change the value of a in the calling function. How do I implement the equivalent in C when extending Python? I know how to write a function that can be called from Python and I know how to use P