This article mainly introduces the implementation of docstring annotations in the python annotation class, which involves the access skills of python class annotations and is very useful, for more information about how to implement docst
What is DocStringIn software engineering, in fact, the part of the code is very small, mostly other things, such as writing documents. Documentation is a tool for communication.In Python, the comparison is respected in the code to write documents, code is the document, more convenient, easy to maintain, intuitive, consistent.After the code is written, the document is out. In fact, Markdown is similar to this idea, the text is finished, typesetting has
1 native Doxygen documentation support for Python annotationsBy default, Doxygen can support both styles of Python annotations, native docstring, and Java doc-like # #. But the actual use is not perfect"" @package docstringdocumentation for the This module. More details. "" " def func (): "" " documentation for a function. More details. "" " PassJava doc
Os:windows 10 Chinese version, python:3.6.4The document string (docstring) in Python appears in the first row of modules, functions, classes , and is used to describe these programs. It is ignored at execution time, but willis stored in the __doc__ property of the module, function, and class by the compiler. However, n
To further standardize PythonCodeTo improve readability and maintainability, it is decided to add docstring to the module, class, and function as much as possible.In my spare time, I wrote a sublime text 2 plugin. You can set the shortcut key or context menu to automatically generate docstring, which reduces the number of words on the keyboard and makes it more s
with a capital letter and ends with a period.The second line is a blank line, starting with a detailed description of the third line. It is strongly recommended that you follow this practice when using document strings in your functions.
You can use __DOC__ (note double underlines) to call the Printmax function's document string property (which is the name of the function). Remember that Python takes everything as an object, including this function.
insert Docstrings fromModules(y/N) [N]:y>doctest:automatically test code snippetsinchdoctest Blocks(y/N) [N]:N>Intersphinx:link betweenSphinxdocumentation of different projects(y/N) [N]:y>Todo:Write"Todo"entries that can shownorHidden on Build(y/N) [N]:N>Coverage:Checks forDocumentation Coverage(y/N) [N]:N>Pngmath:include math,rendered asPNG Images(y/N) [N]:N>Jsmath:include math,renderedinchThe browser byJsmath (y/N) [N]:N>ifconfig:conditional inclusion of content based on config values(y/N) [N
In Python, we typically use docstring to add string explanatory documents under Modules, classes, and functions, making it better for developers to understand what this code does. However, write so many comments, we want a document how to do, the first method can not write the comments directly CTRL + C CTRL + V, at this time Sphinx appeared, solve the problem.To use it, you need to install it first, and in
Understanding and simple use of Python classes and meta-classes (Metaclass)(i) Classes in PythonFirst, the Python classes discussed here are based on modern classes that inherit from object.First in Python, everything is an object. It's very important to understand the meta-class. I'm going to try to understand the cla
Recently in the OPENCV-based license plate recognition, which requires some code for deep learning (python), the development language at the outset chose Python (the source of the scourge).Although the speed of Python is not too slow now, but you must use Python to manipulate the image, when implementing some algorithm
Python class: class creation, data method attributes and access control details, python Access Control
In Python, you can use the class keyword to define your own class, and then create
Introduction to the _ init _ method function in the Python class, the Python class constructor, And the python _ init _
If there is no _ init _ method function in a class, the instance object created using the
In this article, let's look at the built-in class properties in Python, some of whom may have just come into contact with Python's programming language,
python built-in propertiesThe understanding of the relatively small, not clear about
python built-in classesAttribute this aspect of knowledge. In the next article, le
Python learning notes (14) Python class (1), learning notes python class
Basic Concepts
Problem Space: The problem space is the full understanding of a problem. It is composed of the information contained in the problem and the stored information.
Initial status: incomplete
Special properties of the class /Special property of ClassIn Python, classes are defined by class, and classes can be instantiated into instances and invoked using an instance.The class also contains some common special properties.
Special class Properties
Class learning notes in Python and class learning notes in Python
Python uses an object-oriented language that supports inheritance and polymorphism;
Define a Person class:Copy codeThe Code is as follows:>>> Class Person:... Def s
.__init__ (XXX)4, There is also a way to use the adorner, if you follow this method will not perform multiple init#Coding=utf8 fromFunctoolsImportWrapsdefSingleton (CLS):PrintCLS Instances={} @wraps (CLS)defgetinstance (*args, * *kw):ifCls not inchInstances:instances[cls]= CLS (*args, * *kw)returnInstances[cls]returnGetinstance@singletonclassMyClass (object): a= 1M1=MyClass () M2=MyClass ()PrintM1 isM2The Python singleton mode is controlled to initial
1, the program entrance, let main show out:Print (__name__) #__name___是模块中的隐藏字段, function name of the current module runif __name__ = = __main____MAIN__ ()#定义程序入口: In Python, the main function is hidden by default, and the main function, under the currently running module, defines the program entry to make the main function explicit #现出来Def __main__ ():。。。。。。。2. Object-oriented and process-oriented:Object-oriented: Use objects to accomplish tasks, do
Python full stack development 9, object-oriented, meta-class and Singleton, python meta-class
The previous series of blog posts are all about process-oriented programming. Now it's time for a wave of object-oriented explanations.I. Introduction
Object-Oriented Programming is implemented using classes and objects. There
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.