[Tutor] Listing function arguments

Alan Gauld alan.gauld at blueyonder.co.uk
Wed Sep 1 22:56:53 CEST 2004


> Is there a way to list the arguments that a variable is accepting?
>
> For instance, the first line of a function looks like this:
> def cmcopy( aClients = [], sSource = '', sTarget = '', iSource =
0 ):
>
> So I'd like to know the argument names, for
> 1- Know the order at wich the arguments must be passed
> 2- Know what variables to supply for arguments

Lets get our terminology straight first.

aClients, aSource etc are the parameter names of the function cmcopy

If I do:

L = [1,2,3]
s = 'fred'
t = 'tom'
src = 42
cmcopy(L,s,t,src)

The variable names are: L, s, t, src
but the *arguments* are just the values that those variables hold
and they are assined the temporary names

aClients, sSource, sTarget, iSource

for the duration of the function call.


Thus if I do:

cmcopy([1,2,3],'fred','tom',42)

There are no argument names, but the argument values are:
[1,2,3,], 'fred','tom',42

Almost exactly as they were above (except that the lists are not
also referenced by the variables!)

Which names do you want? And what dso you think you can do with them?
If we know what you are trying to achieve we might be able to offer
a better solution. :-)

Alan G.



More information about the Tutor mailing list