Common python built-in Methods

Source: Internet
Author: User

_ Init _ (self,...): Initialize the object and declare it before creating a new object.

_ Del _ (self): release an object, called before the object is deleted.

_ New _ (self, * args, ** ked): instance production operation

_ Str _ (self): called when the print statement is used

_ Delitem _ (self, key): deletes the elements corresponding to the key in the dictionary.

_ Setitem _ (self, key, value): assign values to keys in the dictionary.

_ Getitem _ (self, key): obtains the value corresponding to the index key of the sequence, which is equivalent to seq [key].

_ Len _ (self): called when the inline function len () is called.

_ Cmp _ (src, dst): Compares the src and dst objects.

_ Getattr _ (s, name): obtains the attribute value.

_ Setattr _ (s, name): sets the attribute value.

_ Gt _ (self, other): determines whether the self object is greater than the other object

_ Lt _ (self, other): determines whether the self object is smaller than the other object

_ Ge _ (self, other): determines whether the self object is not greater than the other object

_ Le _ (self, other): judge whether the self object is not smaller than the other object

_ Eq _ (self, other): determines whether the self object is equal to the other object

_ Call _ (self, * args): calls an instance object as a function.

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.