0

I'n new to Python. I have a simple question (I tried looking but I don't think this has been asked before):

I want a function to not return anything but I want it to modify a data structure that I pass as an argument to the function. How do I do this ?

More specifically, in C I have a function with the prototype :

void function(int parameter1,int *parameter2)

How do I do this in Python ?

  • "a data structure", what data structure? – laike9m May 21 '15 at 15:35
  • **TL;DR**: you don't need to do anything; if you pass *a mutable object* (e.g. `dict`, `list`) any changes made to it within the function will be seen by the caller. However note that integers *aren't mutable*. – jonrsharpe May 21 '15 at 15:35
  • I see. I have a list data structure which I needed to be modified. I think this solves my concern. Thank you. – CutestPenguin May 22 '15 at 01:46

0 Answers0