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, ∼2035🔥, 0💬
Popular Posts:
How To Get the Minimum or Maximum Value of an Array in PHP? If you want to get the minimum or maximu...
How to use 'choose ... when ..." policy statements to control execution flows? If you want to contro...
How to add request URL Template Parameters to my Azure API operation to make it more user friendly? ...
How to create a new API on the Publisher Dashboard of an Azure API Management Service? If you are ne...
How to Install Docker Desktop on Windows 10? You can follow this tutorial to Install Docker Desktop ...