On 5/4/06, Rudy Rudolph <[EMAIL PROTECTED]> wrote:
// C++ does not distinguish between in-out and out parameters.
// call them
int x = 2; foo(x); // x is now 7

It is important to avoid this obfuscation.

C's &addr is slightly better, but still pretty error prone with collections, like a string or array.
 
Python:
def foo(paramWrapper):
    paramWrapper[0] += 5

or use named fields of an object

    def foo(data): 
         dataobject.param3 +=5

or return a tuple if you need a multiple-values-return

    x=foo(x)
    val1, val2, val3 = foo(val4, val1, val5)
 
At best, adding an out parameter is the equivalent of adding in-place operators

    a += 1
vs
    a = a + 1


-jJ

_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to