[Tutor] parameters vs arguments

BINTO binto at triplegate.net.id
Fri Nov 6 01:22:13 CET 2009


Parameter is what used to give/call value in function.
Argument is what used to give/call value in command line interface.

Am I correct??...

Binto

-----Original Message-----
From: tutor-bounces+binto=triplegate.net.id at python.org
[mailto:tutor-bounces+binto=triplegate.net.id at python.org] On Behalf Of Alan
Gauld
Sent: Thursday, November 05, 2009 2:08 PM
To: tutor at python.org
Subject: Re: [Tutor] parameters vs arguments


"Kristin Wilcox" <wilcoxwork at gmail.com> wrote

> I'm just starting to learn Python, and some of the vocabulary has me a 
> bit
> confused.

FWIW I take great care in my tutor to highlight and explain the terminology
of programming in my tutor. I italicise new words and explain them on first
use. So it might be useful taking a look there if you find areas of 
confusion.

> I'm reading stuff from multiple sources, and it seems to me like the 
> words
> "parameters" and "arguments" are used interchangeably.

This is a confusing one and people often do get them mixed up.
Basically a parameter is what you call the thing used in the function 
definition.
An argument is whats used  when you call the function.
Thus, at invocation, the parameter takes on the value of the argument.

This is confused futher by some text books using the term "formal argument"
instead of parameter. When you see "formal argument" it does just mean a
parameter. Fortunately this usage is rare nowadays.

> When I define, say, function example like this...
> def example(x,y):
>
> are x and y arguments? or parameters?

parameters

> And when I call the function and pass it values
>
> example(32,17) are those values arguments or parameters? I *thought* this
> was called 'passing arguments'...

arguments

HTH


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 


_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list