Tools, FAQ, Tutorials:
Pass Function as Function Parameter
How to pass function objects as function parameters?
✍: FYIcenter.com
You can pass function objects like any other types of objects as parameters of other functions.
For example,
>>> def x():
... print("Hello world!")
...
>>> def addVersion(f):
... f.version = "1.0"
... f.author = "FYIcenter.com"
... return f
...
>>> y = addVersion(x)
>>> x.version
'1.0'
>>> y.version
'1.0'
⇐ '__dict__' Dictionary in Function Object
2018-02-08, ∼2463🔥, 0💬
Popular Posts:
How to add request URL Template Parameters to my Azure API operation 2017 version to make it more us...
How to add request query string Parameters to my Azure API operation to make it more user friendly? ...
How To Pad an Array with the Same Value Multiple Times in PHP? If you want to add the same value mul...
How to convert a JSON text string to an XML document with PHP language? Currently, there is no built...
How to install .NET Framework in Visual Studio Community 2017? I have the Visual Studio Installer in...