See exactly what a function has returned
Josh Close
narshe at gmail.com
Wed Sep 15 13:51:52 EDT 2004
On Wed, 15 Sep 2004 13:30:22 -0400, Brad Tilley <bradtilley at usa.net> wrote:
> 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
>
> OK,
>
> 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
>
> print_whats_returned(send_net_params_to_admin(get_server_ip(),
> get_server_port()))
def send_net_params_to_admin(ip_param, port_param):
ip = get_server_ip()
port = get_server_port()
return ip, port
print send_net_params_to_damin(ip_param, port_param)
More information about the Python-list
mailing list