"ncf" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Example C Code: > #define P(a,b,c,d,e,f,g,h,x,K) \ > { \ > temp1 = h + S3(e) + F1(e,f,g) + K + x; \ > temp2 = S2(a) + F0(a,b,c); \ > d += temp1; h = temp1 + temp2; \ > }
> Python Code: > def P(a,b,c,d,e,f,g,h,x,K): > temp1 = h + S3(e) + F1(e,f,g) + K + x > temp2 = S2(a) + F0(a,b,c) > d += temp1; h = temp1 + temp2 Your problem is that you are replacing a C macro, which is inlined and affects the original 'namespace' in which it appears, and which does not have a direct Python equivalent, with a Python function (admittedly slower), which performs its calculation in a separate namespace. So you have to pass the results back to the calling namespace. Simple enough: make the last line of P return d+temp1, temp1+temp2 and the call a4,a8 = P(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) The stuff about mutability and calling conventions is important to learn eventually but seems beside the point for your immediate application. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list