确切了解函数返回的内容 [英] See exactly what a function has returned

查看:47
本文介绍了确切了解函数返回的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有更简单的方法吗:


def print_whats_returned(功能):

打印功能

打印类型(功能)

Is there an easier way to do this:

def print_whats_returned(function):
print function
print type(function)

推荐答案

Brad Tilley写道:
Brad Tilley wrote:
有没有更简单的方法:

def print_whats_returned(功能):
打印功能
打印类型(功能)
Is there an easier way to do this:

def print_whats_returned(function):
print function
print type(function)




什么是这个 ?主题行和名称

函数暗示它与函数的

返回值有关,但函数是
$ b $从未打过电话。虽然Python有时被称为

可执行伪代码,但我认为在这种情况下你会更好地用简单的英语描述什么

你的目标是。


-Peter



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


Peter Hansen写道:
Peter Hansen wrote:
Brad Tilley写道:
Brad Tilley wrote:
有没有更简单的方法:

def print_whats_returned(功能):
打印功能
打印类型(功能) )
Is there an easier way to do this:

def print_whats_returned(function):
print function
print type(function)



什么是this?主题行和函数的名称暗示它与函数的返回值有关,但函数从未被调用过。虽然Python有时被称为可执行的伪代码,但我认为在这种情况下,你最好用简单的英语描述你的目标是什么。

-Peter


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(功能):

##一个显示另一个函数返回的函数

##以及返回数据的''type'。

打印函数

打印类型(功能)

def send_net_params_to_admin(ip​​_param,port_param):

ip = get_server_ip()

port = get_server_port ()

返回ip,端口


print_whats_returned(send_net_params_to_admin(get_server_ip(),

get_server_port()))



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()))


2004年9月15日星期三13:30:22 -0400,Brad Tilley< br ******** @ usa.net>写道:
On Wed, 15 Sep 2004 13:30:22 -0400, Brad Tilley <br********@usa.net> wrote:
Peter Hansen写道:
Peter Hansen wrote:
Brad Tilley写道:
Brad Tilley wrote:
有没有更简单的方法:

def print_whats_returned(功能):
打印功能
打印类型(功能)
Is there an easier way to do this:

def print_whats_returned(function):
print function
print type(function)



什么是this?主题行和函数的名称暗示它与函数的返回值有关,但函数从未被调用过。虽然Python有时被称为可执行的伪代码,但我认为在这种情况下,你最好用简单的英语描述你的目标是什么。

-Peter


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(函数):
##显示另一个函数返回的函数 ##以及返回数据的''type'。
打印功能
打印类型(功能)
def send_net_params_to_admin(ip​​_param,port_param):
ip = get_server_ip()
port = get_server_port()
返回ip,端口

print_whats_returned(send_net_params_to_admin(get_server_ip(),
get_server_port()))



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()

返回ip,端口


打印send_net_params_to_damin(ip​​_param,port_param)



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)


这篇关于确切了解函数返回的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆