First, the memory model
Classification of variables based on their organization in memory
The type of Python, like most other languages, can hold one or more values. A type that can hold a single literal object we call it atomic or scalar storage , those types that can hold multiple objects, which we call container storage . (Container objects are sometimes referred to as compound objects in a document, but they do not just refer to types, but also include objects such as class instances)
Storage Model
category |
Python Type |
Scalar/Atomic Type |
Numeric (all numeric type) strings (all text) |
Container Type |
Lists, tuples, dictionaries |
Second, the Access model
Classify data types according to how you access the data that we store. There are three ways to access the model: direct access, order, and mapping .
Pyth On data type |
Access model |
Digital |
& nbsp Direct access to |
strings, lists, tuples |
sequential access |
Dictionary |
map access |
Third, update the model
Some types allow their values to be updated, while others are not allowed. (value is changed)
Data Type |
Storage Model |
Update Model |
Access Model |
Digital
|
Scalar |
Cannot be changed |
Direct access |
String
|
Scalar |
Cannot be changed |
Sequential access |
List |
Container |
Can be changed |
Sequential access |
Meta-group |
Container |
Cannot be changed |
Sequential access |
Dictionary |
Container |
Can be changed |
Map Access |
Add:
A dictionary is an unordered storage structure that includes a keyword (key) and a value that corresponds to a keyword (value). The format of the dictionary is: dictionary = {Key:value}. A keyword is an immutable type , such as a string, an integer, a tuple that contains only immutable objects, and a list that cannot be used as a keyword. If there is a keyword pair in the list, you can construct the dictionary directly with Dict ().
The only difference between set and dict is that it does not store the corresponding value, but the set principle is the same as the dict, so it is also not possible to put mutable objects, because it is not possible to determine whether the two Mutable objects are equal, and there is no guarantee that there will be no duplicate elements inside the set. Try putting the list in set to see if it will give an error.
Benbow in the dictionary (dict) and set (set) is somewhat ambiguous, if you read the blog has suggestions or ideas, you can discuss together.
qq:2406235544
This article is from the "Operations Diary" blog, make sure to keep this source http://gyyblog.blog.51cto.com/8666992/1924039
Python Basic Data classification method