Python-socket Network Programming

Source: Internet
Author: User

1. The special member method of the class 1.1__doc__ represents the description information of the class

1.2__module__ and __class__

__MODULE__ represents the object of the current operation in that module

__CLASS__ represents the class to which the current operation's object belongs

The 1.3__init__ constructor, when the object is created by the class, automatically triggers the 1.4__del__ destructor, which is automatically triggered when the function execution is complete. Automatic triggering when manually triggering 1.5__call__ object brackets in normal situations

Note: The execution of the construction method is triggered by the creation object, that is: Object = class name; for the execution of the __call__ method

Is triggered by an object followed by parentheses: Object () or Class () ()

1.6__dict__ viewing the member properties of a class or object

1.7__str__ if the __str__ method is defined in a class, the output object automatically triggers its return value

1.8__getitem__,__setitem__,__delitem__

Used for index operations, such as dictionaries, which are obtained, set, deleted, respectively

2. Create Class two ways

#type第一个参数:类名

#type第二个参数:当前类的基类

#type第三个参数:类的成员

The class's build call order is __new__---__call__--and __init__

3. Reflection

There are four ways to do this by using a string or by modifying the program's Running state:

Hasattr to determine whether a property exists

GetAttr Getting properties

SetAttr Setting properties

Delattr Deleting properties

Importing modules as strings

Import__import__('import_lib.metaclass'#  This is the interpreter's own internal use of the #importlib.import_module (' Import_lib.metaclass ') #与上面这句效果一样, the official proposal with this

4. Exception Handling

5. Network programming

Python-socket Network Programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.