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, ∼2188🔥, 0💬
Popular Posts:
How to create a "Sign-up or Sign-in" user flow policy in my Azure AD B2C directory? If you want to b...
How to create a "Sign-up or Sign-in" user flow policy in my Azure AD B2C directory? If you want to b...
How to create a navigation file like navigation.xhtml for an EPUB 3.0 book? At least one navigation ...
How to use the XML to JSON Conversion Tool at freeformatter.com? If you want to try the XML to JSON ...
Where Is the Submitted Form Data Stored in PHP? When a user submit a form on your Web server, user e...