Re: Howto pass Array/Hash into Function

Discussion in 'Python' started by Gabriel G, Oct 3, 2006.

  1. Gabriel G

    Gabriel G Guest

    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
    Gabriel G, Oct 3, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wijaya Edward

    Howto pass Array/Hash into Function

    Wijaya Edward, Oct 3, 2006, in forum: Python
    Replies:
    6
    Views:
    1,112
    Fredrik Lundh
    Oct 3, 2006
  2. rp
    Replies:
    1
    Views:
    516
    red floyd
    Nov 10, 2011
  3. Anthony Martinez
    Replies:
    4
    Views:
    270
    Robert Klemme
    Jun 11, 2007
  4. Mark Mr
    Replies:
    4
    Views:
    144
    7stud --
    Feb 15, 2008
  5. Srijayanth Sridhar
    Replies:
    19
    Views:
    612
    David A. Black
    Jul 2, 2008
Loading...

Share This Page