返回无 [英] return None

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

问题描述

我可以做一个不返回任何东西的功能吗?


问题是,如果我做的功能是返回或没有

返回,它总是返回None,但我希望它不会返回我

没有


谢谢

Can I do a function which don''t return anything?

The question is that, if I do a function that have a return or without
return, it returns always "None", but i want that it doesnt return me
nothing

Thanks

推荐答案

Ximo写道:
我可以做一个不退货的功能吗?

问题是,如果我做了一个返回或没有返回的函数,它总是返回无,但我希望它不会返回我
没有什么
Can I do a function which don''t return anything?

The question is that, if I do a function that have a return or without
return, it returns always "None", but i want that it doesnt return me
nothing




当你执行声明时


a = myfunction()

如果不是什么,你想成为什么?

-

Michael Hoffman



When you execute the statement

a = myfunction()

What do you want to be in a, if not None?
--
Michael Hoffman


Ximo写道:
我可以做一个什么东西不回来?

问题是,如果我做了一个功能如果返回或没有
返回,它总是返回无,但我希望它不会返回我
没有
Can I do a function which don''t return anything?

The question is that, if I do a function that have a return or without
return, it returns always "None", but i want that it doesnt return me
nothing




什么都不是,或者不是吗?


你可能打印这个功能,当然你需要什么。你可以称之为:


def x():

通过


print x()#call打印

x()#只打电话


x()打印什么都没有,甚至不打印;-)

-

geon
$ b $bVyjímkajepravidlo。 Rekurzivní。



Nothing is None, or isnt?

You probably print the function, what you neednt, of course. You can just call it:

def x():
pass

print x() # calling with printing
x() # calling only

x() prints really nothing, even not None ;-)
--
geon
Vyjímka je pravidlo. Rekurzivní.


在文章< 3k ************ @ individual.net> ;, Ximo< el ***** @ yahoo.es>写道:
In article <3k************@individual.net>, Ximo <el*****@yahoo.es> wrote:
我可以做一个不返回任何东西的函数吗?

问题是,如果我做了一个返回或没有返回的函数>返回,​​它总是返回无,但我希望它不会返回我
没有什么
Can I do a function which don''t return anything?

The question is that, if I do a function that have a return or without
return, it returns always "None", but i want that it doesnt return me
nothing




你是什么意思不要 t返回任何,反对返回

无?假设我有其中一个功能,并做了:


foo = noReturnValue()

print foo


您期望(想要?)发生什么?



What do you mean by "don''t return anything", as oppossed to returning
None? Let''s say I had one of those functions, and did:

foo = noReturnValue()
print foo

what would you expect (want?) to happen?


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

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