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, ∼2025🔥, 0💬
Popular Posts:
What properties and functions are supported on http.client.HTTPResponse objects? If you get an http....
How to reinstall npm with a node version manager? I am getting permission errors with the current ve...
Where to get the detailed description of the json_encode() Function in PHP? Here is the detailed des...
How to install "The Windows SDK version 8.1"? I need to build my Visual Studio C++ applications. If ...
How To Break a File Path Name into Parts in PHP? If you have a file name, and want to get different ...