python--Object-oriented supplementary instructions

Source: Internet
Author: User
Additional notes:

1, the station angle is different, the definition of the class is different

2, the real class is not exactly equal to the class in the program, such as the real company class, in the program sometimes need to split into departmental class, business class, etc.

3, sometimes in order to programming requirements, the program may also define the real non-existent classes, such as the policy class, the reality does not exist, but in the program is really a very common class

All objects in Python, the concept of class and type is unified in Python3

For example:

Print (Type ([1, 2])) results

<class ' list ' > for List class,

Print (list)
Print (luffystudent)
The result is:

<class ' list ' > listing classes
<class ' __main__. Luffystudent ' > function class

There is also a list:

L = list ([+])
Print (L)
The result is: [1, 2, 3] equivalent to the list class example of an object
L1 = [A]
L2 = []
List.append (L1, 4)
Print (L1)
The results are: [1, 2, 3, 4] and L1.append (4) is the same effect, the object calls the Function property, the object is passed to self by default, if the class is executed, but also to pass in the object, so the execution is also more troublesome, the reality is seldom used in this way,

python--Object-oriented supplementary instructions

Related Article

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.