参数VS参数?最后,它们是什么? [英] Parameter vs Arguments ? finally,what are they?

查看:151
本文介绍了参数VS参数?最后,它们是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Python编程初学者,最近我碰到的功能,参数,参数和...

I am a beginner in python programming and recently i came across functions,parameters,arguments and...

我已经做了很多的参数和变量的研究(即使检查了计算器上类似过去的问题的答案),但我无法得到它们的含义。

I have done a lot of research on Parameters and Arguments(Even checked the answers of similar past questions on StackOverflow)but i couldn't get their meanings.

有人说,参数是我们给他们的功能,而我们正在定义他们的论点是传递函数,一旦我们以运行function.While他们给予函数值的变量一些其他的说没有,这是不喜欢that.Parameters和参数相同,做同一个任务...

Some say,parameters are variables which we give them to functions while we are defining them and arguments are values that are passed in function once we given them to the function in order to run the function.While some other say no,it's not like that.Parameters and Arguments are same and do the same task...

谁能告诉我的意义的参数和参数以明确的方式?

Can anyone tell me the meaning Parameters and Arguments in a clear way?

被认为是变量参数和变量?

Are Parameters and Arguments considered variables?

有关什么样的目的,我们使用他们?

For what kind of purpose do we use them?

请不要解释太多复杂的,我是一个初学者。

Please don't explain too much complicated,i am a beginner.

感谢您这么多。

推荐答案

每的官方文档

参数的是由出现在函数定义的名称定义的,而参数的是调用它时实际传递给函数的值。参数定义什么类型的参数的函数可以接受。例如,给定函数的定义:

Parameters are defined by the names that appear in a function definition, whereas arguments are the values actually passed to a function when calling it. Parameters define what types of arguments a function can accept. For example, given the function definition:

def func(foo, bar=None, **kwargs):
    pass

的和的 kwargs 的是参数FUNC 。然而,当调用 FUNC ,例如:

foo, bar and kwargs are parameters of func. However, when calling func, for example:

func(42, bar=314, extra=somevar)


  
  

42 314 somevar 有观点。

词汇表将它们定义为:


  • 参数 :一个值传递一个函数(或方法)调用函数时。

  • 参数 :命名实体在指定的参数(或在某些情况下,自变量)该函数可以接受的函数(或方法)的定义。

Python没有真的有变数像一些其他语言 - 它有名指的是物。例如参见<一href=\"http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#other-languages-have-variables\"相对=nofollow>code像Pythonista和事实与神话有关Python的名称和值

Python doesn't really have "variables" like some other languages - it has "names" referring to "objects". See e.g. "Code like a Pythonista" and "Facts and myths about Python names and values".

这篇关于参数VS参数?最后,它们是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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