See exactly what a function has returned

Brad Tilley bradtilley at
Wed Sep 15 19:30:22 CEST 2004

Peter Hansen wrote:
> Brad Tilley wrote:
>> Is there an easier way to do this:
>> def print_whats_returned(function):
>>     print function
>>     print type(function)
> What is "this"?  The subject line and the name of
> the function imply it is something to do with the
> return values of a function, yet the function is
> never called.  While Python is sometimes called
> executable pseudo-code, I think in this case you'd
> be better off using plain English to describe what
> your goal is.
> -Peter


def print_whats_returned(function):
     ## A function that shows what another function has returned
     ## as well as the 'type' of the returned data.
     print function
     print type(function)

def send_net_params_to_admin(ip_param, port_param):
     ip = get_server_ip()
     port = get_server_port()
     return ip, port


More information about the Python-list mailing list