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, ∼2138🔥, 0💬
Popular Posts:
Where to get the detailed description of the json_encode() Function in PHP? Here is the detailed des...
How to build a PHP script to dump Azure AD 2.0 Authentication Response? If you are use the Azure-AD-...
What are "*..." and "**..." Wildcard Parameters in Function Definitions? If you want to define a fun...
How to access URL template parameters from "context.Request.Matched Parameters"object in Azure API P...
How To Create an Array with a Sequence of Integers or Characters in PHP? The quickest way to create ...