Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ Python data types summary     - RHEL 6.6 install GNOME desktop environment (Linux)

- OpenCV cvFindCornerSubPix () to find sub-pixel Corner (Programming)

- Use OpenWrt build WDS wireless network extension on V2 WHR-G300N (Linux)

- Using iptables achieve NAT (Linux)

- ASM Disk Space Check (Database)

- Analysis: Little Notebook facing a major security threat secure online (Linux)

- The Linux-based security settings Ipchains Firewall (Linux)

- Java Set and List in the relationship and difference (Programming)

- FileZilla FTP && TLS connection settings of (Linux)

- Linux text processing tool of awk (Linux)

- CentOS How quickly customize kernel binary RPM package (Linux)

- Install Git on CentOS (Linux)

- Ubuntu install Eclipse for C / C ++ and related configuration (Linux)

- Use C program in JavaScript (Programming)

- Effect MongoDB plan cache (Database)

- To install and deploy Java applications under CentOS 6.5 (Linux)

- To learn from scratch OpenWrt perfect tutorial (Linux)

- Linux command in the dialog whiptail (Linux)

- CentOS NAT iptables (Linux)

- Four IDS intrusion detection tool under Linux environment (Linux)

  Python data types summary
  Add Date : 2018-11-21      
  In situ type variable and immutable types

Situ immutable type can be called a hash (hashable) type, also known as in situ variable type is not available hash type.

Situ immutable type:

Numeric types: int, float, decimal.Decimal, fractions.Fraction, complex
String type: str, bytes
Boolean type: True, False
Situ variable type:


How to actually test whether a variable place

hash or will return to their home can not change the type of hash value, if a second call to place variable type function, then returns TypeError.
Only hash types can only be used as dict key.
Only the type of hash can only be placed in the set, so the set itself is not stored in a set of nested.
for example:

>>> Hash (b'aaa ')
>>> Hash (bytearray (b'aaa '))
Traceback (most recent call last):
  File "< stdin>", line 1, in < module>
TypeError: unhashable type: 'bytearray'
>>> Hash (frozenset ({1,2,3}))
>>> Hash ({1,2,3})
Traceback (most recent call last):
  File "< stdin>", line 1, in < module>
TypeError: unhashable type: 'set'
How to verify whether the operation is a practical place changed.

Built-in function id () returns the address of an object actually stored in memory.

>>> L = [1]
>>> Id (L)
>>> L.append (2)
>>> Id (L)
49689480 # in-place editing, so you can see the store address has not changed.
>>> S = 'aa'
>>> Id (s)
>>> S + = 'bb'
>>> Id (s)
# 49700008 not in place due to the changes, so when the string changes, opened up a new store a memory address.
Data stored in an orderly manner

Ordered data type

Ordered data type called sequence, support indexing, slicing, addition, multiplication, calculate the length, compare the size of the operation.
Comparison will compare the size of each element in turn, if not followed when comparing the same type found will pop up an error.


Unordered data type

- Using Linux / Unix Text processing (Linux)
- Linux network security strategy (Linux)
- Ten best plug surge Emacs Productivity (Linux)
- Linux Hard Disk Partition and file system management (Linux)
- Linux protobuf-c (Linux)
- Share and show your code on GitHub (Linux)
- Linux5.8 installed phpMyAdmin was unable to issue related php-mcrypt (Database)
- Embedded Linux Optimization (Programming)
- SELinux multi-level security (Linux)
- Ubuntu 14.04 and derivative versions of the user install Pantheon Photos 0.1 (Linux)
- impdp error ORA-39001, ORA-39000, ORA-31619 (Database)
- How to forcibly change the Linux system password on a regular basis (Linux)
- C ++ multithreading and critical resource instance (Programming)
- Linux, Eclipse flash back and reinstall the JDK methods (Linux)
- C language files update in real time (Programming)
- VMware virtual machine Ubuntu install arm-linux-gcc cross-compiler environment (Linux)
- CentOS / RHEL 6 was repeated prohibited under the SNMP connection log (Server)
- Linux installed Cisco Packet Tracer (Linux)
- Configuring ftp server and nfs server under Linux (Server)
- Oracle 11g new features of the collection of multi-column statistics (Database)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.