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, ∼2148🔥, 0💬
Popular Posts:
How to add an API to an API product for internal testing on the Publisher Portal of an Azure API Man...
How To Change Text Fonts for Some Parts of a Paragraph? If you want to change text fonts or colors f...
What's Wrong with "while ($c=fgetc($f)) {}" in PHP? If you are using "while ($c=fgetc($f)) {}" to lo...
How to read RSS validation errors at w3.org? If your RSS feed has errors, the RSS validator at w3.or...
How to validate the id_token signature received from Azure AD v2.0 authentication response? You can ...