[Tutor] Passing Arguments

Don Parris gnumathetes at gmail.com
Sat Jul 9 11:17:15 CEST 2005


For some reason, everytime I think I finally understand the passing
arguments thing, I prove that I don't.  However, I *am* getting a
little closer to getting it.

# Here I just created a couple of variables to print, and then
prt_Name returns g.
def prt_Name():
    g = 'foo'
    a = 'bar'
    print g
    print a
    return g

# get_Name will get the argument from prt_Name:
def get_Name(b):
    print 'f'
    print b

get_Name(prt_Name)
# Calling get_Name with prt_Name as the argument produces this:

C:\Python24>python scripts\learning.py
f
<function prt_Name at 0x00AEBEF0>

At least it found the function.  That's little shy of a miracle for
me. :)  However, I would like to see 'foo' printed out, since it is
the result of the function.  How can I correct this?

Thanks,
Don
-- 
DC Parris GNU Evangelist
http://matheteuo.org/
gnumathetes at gmail.com
Free software is like God's love - 
you can share it with anyone anywhere anytime!


More information about the Tutor mailing list