Tools, FAQ, Tutorials:
'__dict__' Dictionary in Function Object
What is the "__dict__" dictionary property in a function object?
✍: FYIcenter.com
By default every function object has "__dict__" built-in dictionary property.
Each name value pair in this dictionary becomes a formal property of the
function object accessible using the "." operation.
It is empty when the function object is created. But you can add name value pairs to the "__dict__" dictionary.
For example, the following Python code shows how to use the "__dict__" dictionary of function object:
>>> def x():
... print("Hello world!")
...
>>> x.version = "1.0"
>>> x.__dict__["author"] = "FYIcenter.com"
>>> x.__dict__
{'version': '1.0', 'author': 'FYIcenter.com'}
>>> x.version
'1.0'
>>> x.author
'FYIcenter.com'
⇒ Pass Function as Function Parameter
2018-02-08, ∼2046🔥, 0💬
Popular Posts:
How to use the "forward-request" Policy Statement to call the backend service for an Azure API servi...
How to register and get an application ID from Azure AD? The first step to use Azure AD is to regist...
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as...
How To Read Data from Keyboard (Standard Input) in PHP? If you want to read data from the standard i...
How to enter & sign in '@(...)' expressions? & signs can be entered in '@(...)' expr...