Python class private method

巴扎黑
Release: 2016-12-09 09:15:26
Original
1496 people have browsed it

Class private method

__private_method starts with two underscores, declaring that the method is a private method and cannot be called outside the class.

Call slef.__private_methods inside the class.

Proprietary methods of class:

__init__ constructor, call

__del__ destructor when generating an object, use

__repr__ to print and convert

__setitem__ to assign according to index

__getitem__ to obtain according to index Value

__len__ gets length

__cmp__ comparison operation

__call__ function call

__add__ addition operation

__sub__ subtraction operation

__mul__ multiplication operation

__div__ division operation

__mod__ remainder operation

__pow__ weighing square


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template