Steven D'Aprano <st...@pearwood.info>:

> On Mon, 05 May 2014 17:39:44 -0700, Satish Muthali wrote:
>> I have a burning question on how to pass variable by reference in
>> Python. I understand that the data type has to be mutable.
>
> [...]
>
> To get an effect *similar* to pass-by-reference, you can wrap your 
> variable in a list, and then only operate on the list item.

Consider also returning multiple values in a tuple.

In C:

    stats_read(stats, &characters, &words, &lines);

In Python:

    characters, words, lines = stats.read()


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to