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, ∼2467🔥, 0💬
Popular Posts:
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as...
How to use the "send-one-way-request" Policy statement to call an extra web service for an Azure API...
Where to find tutorials on RSS specifications? I want to learn it to describe my API services. Here ...
How to how to use matched string and groups in replacements with re.sub()? When calling the re.sub()...
Where to find tutorials on Visual Studio? I want to know How to learn Visual Studio. Here is a large...