Perl to Python: Subroutines & Functions

Subroutines

<i> Contrary to Perl you first need to have a subroutine declared before you can use it. So the defs are the first thing in your script. Then comes the main part. When calling one def from another def the order does not matter.

Arguments with =... are optional:

Arguments can be given in any order:

Multiple arguments can be passed as a tuple:

Unpack a list before sending it to a subroutine:

Print the first comment (“““ Blah “““) of a subroutine:

WorkaroundOrg: PerlToPython/Functions (last edited 2005-08-29 17:57:29 by ChristophHaas)