Labs / Python OOP

The Most Beginner-Friendly Object Oriented Programming Tutorial on the Whole Network: 05 Python Implementation of Classes and Objects - PyCharm Code Tags (A Tip to Boost Your Coding Efficiency)

Author: Li Zisheng · Source: FreakStudio open documentation · License: CC BY 4.0

Contents

Abstract:

This article introduces the definition, types and usage of code tags in the PyCharm IDE.

Previous Recommendations:

You who are learning embedded systems still don't know Object Oriented? ?!

The Most Beginner-Friendly Object Oriented Programming Tutorial on the Whole Network: 00 Introduction to Object Oriented Design Methodology

The Most Beginner-Friendly Object Oriented Programming Tutorial on the Whole Network: 01 Basic Concepts of Object Oriented Programming

The Most Beginner-Friendly Object Oriented Programming Tutorial Across the Network: 02 Python Implementation of Classes and Objects - Creating Classes with Python

The Most Beginner-Friendly Object Oriented Programming Tutorial on the Whole Network: 03 Python Implementation of Classes and Objects – Adding Attributes to Custom Classes

The Most Beginner-Friendly Object Oriented Programming Tutorial on the Whole Network: 04 Python Implementation of Classes and Objects – Adding Methods to Custom Classes

More exciting content can be found here:

Speed Up Your Python: A Quick Guide to Python Parallel Computing

Understand the Debugging Principle of CM3 Microcontroller in One Article

After half a month of dedicated grinding, the ultimate summary of embedded technology stack is now released

The "Secret Martial Arts Manual" for Computer Science Competitions

Access to Documents and Code

You can access the following link to download the document:

https://github.com/leezisheng/Doc

1 0 74 19 1.2

This document mainly introduces how to use Python for Object Oriented programming, and requires readers to have a basic understanding of Python syntax and microcontroller development. Compared with other blogs or books that explain Python Object Oriented programming, this document is more detailed and focuses on embedded host computer applications. It takes the common serial port data transmission and reception, data processing, dynamic graph drawing and other functions between the host computer and the lower computer as application examples, and uses the Sourcetrail code software to visually read the code to facilitate readers' understanding.

The link to obtain the relevant sample code is as follows: https://github.com/leezisheng/Python-OOP-Demo

Body Text

In the comments for class methods in the previous article, you may have noticed that there is a line below each method that reads:

# TODO: open serial port method to be completed

In Pycharm, it looks like this:

The Most Beginner-Friendly Object Oriented Programming Tutorial on the Whole Network: 05 Python Implementation of Classes and Objects - PyCharm Code Tags (A Tip to Boost Your Coding Efficiency)

You may have encountered similar markers in other code, such as FIXME, NOTE, UNDONE, and so on. These are tags in comments, sometimes also referred to as "codetags" or "tokens". They are informally used markers in code writing, but in project development, they enable coders to achieve the functions of prompting, indexing and quick locating within the code. In most IDEs or text editors, comments starting with the tags mentioned above will also have special syntax highlighting.Code tags are essentially a special type of comments that are highlighted in the editor, indexed, and listed in the TODO tool window.

AZ_DV7

Among them, TODO indicates the code that is about to be written, and describes the tasks that need to be completed or the functions that need to be implemented.

The TODO format is as follows:

# TODO(name): Need implementation

In Pycharm, we can see all TODO-tagged functions in the bottom navigation bar:

The Most Beginner-Friendly Object Oriented Programming Tutorial on the Whole Network: 05 Python Implementation of Classes and Objects - PyCharm Code Tags (A Tip to Boost Your Coding Efficiency)

In addition to TODO, there is also the FIXME tag, which indicates a bug that needs to be fixed. By using code tags, when coding a project that contains multiple files, we can quickly find the methods/functions to be completed as well as the bugs to be fixed.

347622978