Python private method

Source: Internet
Author: User
The class private method _ private_method starts with an underscore. it is declared as a private method and cannot be called outside the class. Call slef. _ private_methods within the class. Class proprietary method: __init _ constructor. When an object is generated, the _ del _ destructor is called. when the object is released, the _ repr _ print is used, convert _ setitem _ to assign value by INDEX _ getitem _ to obtain value by INDEX _ l...

Class Private method

_ Private_method starts with two underscores. it is declared as a private method and cannot be called outside the class.

Call slef. _ private_methods within the class.

Class proprietary method:

_ Init _ constructor called when an object is generated

_ Del _ destructor used to release objects

_ Repr _ print, convert

_ Setitem _ assign values based on the index

_ Getitem _ obtain the value based on the index

_ Len _ get the length

_ Cmp _ comparison calculation

_ Call _ function call

_ Add _ addition operation

_ Sub _ subtraction

_ Mul _ multiplication operation

_ P _ division operation

_ Mod _ remainder operation

_ Pow _ caller

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.