Detailed explanation of some basic concepts in python

零下一度
Release: 2017-06-25 10:21:20
Original
1346 people have browsed it

Object-oriented:

Concepts: class, instantiation, object, instance

Properties:

Public properties: defined in the class

Members Attributes: Defined in the method

Private attributes: Use the __ attribute in the method to define restricted external access

Method:

Ordinary method

Class method : @classmethod decorates the class name. Called by default (cls)

Static method: @staticmethod decorates the class name. Called, it has nothing to do with the class itself, and is equivalent to a tool function in the class

Attribute method: @property decoration is called as an attribute

Built-in method: (special method) __new__ triggers __init__ to create an instance

__init__ constructor method

__doc__ View the description information of the class

__module__ Which module is the object currently operated on

__class__Which class was created by the object currently operated on

__del__ The destructor method is automatically executed when the current object is released in memory

__dict__ View members in the class or object

__str__ If this method is defined in a class, then print The return value of this method is output by default when the object is used

To define in what form it is created

 

The above is the detailed content of Detailed explanation of some basic concepts in python. For more information, please follow other related articles on the PHP Chinese website!

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