Howto pass Array/Hash into Function

Gabriel G gabrielg_laburando at yahoo.com.ar
Tue Oct 3 05:52:00 EDT 2006


At Tuesday 3/10/2006 06:05, Wijaya Edward wrote:

>How can I pass Array, Hash, and a plain variable
>in to a function at the same time.
>
>I come from Perl. Where as you probably know
>it is done like this:
>
>sub myfunc {
>
>     my ($plain_var, $hash_ref,$arref) = @_;
>     # Do sth with those variables
>
>    return;
>}

In Python your functions have formal arguments:

def myfunc(plain_var, some_dict, some_list):
     # ...
     return

You also have positional and keyword arguments, and default values. 
Read the Python tutorial <http://www.python.org/doc/current/tut/tut.html>



Gabriel Genellina
Softlab SRL 


	
	
		
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas




More information about the Python-list mailing list