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, ∼1772🔥, 0💬
Popular Posts:
What is EPUB 2.0 Metadata "dc:publisher" and "dc:rights" elements? EPUB 2.0 Metadata "dc:publisher" ...
Why I am getting "The Windows SDK version 8.1 was not found" error, when building my C++ application...
How to install .NET Framework in Visual Studio Community 2017? I have the Visual Studio Installer in...
What is EPUB 2.0 Metadata "dc:creator" and "dc:contributor" elements? EPUB 2.0 Metadata "dc:creator"...
Where to find tutorials on HTML language? I want to know how to learn HTML. Here is a large collecti...