How Python __dict__ is used

Purpose

I didn't understand how to use ** \ _ \ _dict \ _ \ _ in Python. ** ** I saw a good example Shown.

How to use dict

At the following site Using ** \ _ \ _ dict \ _ \ _ **, List of objects that can take the len function as an argument How to find out was shown.

https://python.ms/len/#_1-len-の考え方

>>> builtin_sized_types = []
>>>
>>>
>>> for val in __builtins__.__dict__.values():
...     if isinstance(val, type):
...         if hasattr(val, '__len__'):
...             builtin_sized_types.append(val)
...
>>> print(*builtin_sized_types, sep='\n')

Execution result

<class 'memoryview'>
<class 'bytearray'>
<class 'bytes'>
<class 'dict'>
<class 'frozenset'>
<class 'list'>
<class 'range'>
<class 'set'>
<class 'str'>
<class 'tuple'>
>>>

from now on

If you don't get used to it, you can't use it like this. .. .. I feel like I've learned. Please give me any advice.

Recommended Posts

How Python __dict__ is used
Python is easy
[Python] [pandas] How is pd.DataFrame (). T implemented?
Python Dict category
What is python
Python is instance
How to use is and == in Python
What is Python
python int is infinite
How to install Python
[Python] What is Pipeline ...
How to install python
[Python] What is virtualenv
How tuples work | Python
[Python] How to sort dict in list and instance in list
How Python __dict__ is used
Your multi-layer perceptron is dirty
What is your "Tanimoto coefficient"?
How to test that Exception is raised in python unittest
[Python] Debugging is more efficient!
Differences in sys.path depending on how Python is started (v3.8.2)
How to install Python [Windows]
How Python module import works
How is pyenv switching versions?
python3: How to use bottle (2)
mkdocs: How HTML is generated
[Python] How to use list 1
Python basic dict sort order
Python is painful. But use
How to update Python Tkinter to 8.6
Python is an adult language
Use list-keyed dict in Python
How to use Python argparse
[Python] Frequently used library code
Python list is not a list
Python: How to use pydub
[Python] How to use checkio
[Python] Python and security-① What is Python?
How to run Notepad ++ Python
Python release cycle is faster!
Python frequently used code snippets
[Python] * args ** What is kwrgs?
How to change Python version
How to develop in Python
[python] How to judge scalar
Identity and equivalence Python is and ==
[Python] How to use input ()
How to use Python lambda
[Python] How to use virtualenv
python3: How to use bottle (3)
python3: How to use bottle
What is a python map?
How to use Python bytes
Python Basic Course (1 What is Python)
How is the progress? Let's get on with the boom ?? in Python
[Python] Until CuPy is installed on Windows 10 and CUDA core is used
Behavior when 0, 1, False, True is used for the dictionary (dict) key
How to judge that the cross key is input in Python3
How to use the asterisk (*) in Python. Maybe this is all? ..
How to utilize Python with Jw_cad (Part 1 What is external transformation)
(Python) I analyzed 1 million hands ~ How many times AA is distributed? ?? ~
I did a lot of research on how Python is executed
How to install python using anaconda