1. By storage: Atomic type and container type
Atomic type: Can contain only one object
Container type: can contain multiple objects
Classification |
Python type |
Atomic type |
Numeric and string |
Container type |
Lists, tuples, and dictionaries |
2. Press to see if it can be changed: variable and immutable
Classification |
Python type |
Immutable types |
values, tuples, and strings |
Variable type |
List, dictionary |
Here's what we need to illustrate: why values and strings are immutable, we illustrate by following an example:
From the above two images we can see, in fact, the value behind is simply a new object, re-assignment, so that the value and string is immutable
Then look at the tuple:
Although the value inside has changed, the entire tuple object has not changed, so the tuple is mutable.
3. Access by object slicing: direct access, sequential access, mapped access
Classification |
Python type |
Direct access |
Numerical |
Sequential access |
list, tuple, string |
Map Access |
Dictionary |
There are no more examples here, there are many concrete examples in the QuickStart.
Right here, thank you.
------------------------------------------------------------------
Click to jump 0 basic python-Catalogue
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
0 Basic python-4.5 Standard type classification