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, ∼2101🔥, 0💬
Popular Posts:
How to detect errors occurred in the json_decode() call? You can use the following two functions to ...
Can Multiple Paragraphs Be Included in a List Item? Yes. You can include multiple paragraphs in a si...
How to view API details on the Publisher Dashboard of an Azure API Management Service? You can follo...
How To Create an Array with a Sequence of Integers or Characters in PHP? The quickest way to create ...
Where to find tutorials on JSON (JavaScript Object Notation) text string format? I want to know how ...