10 ways Python developers can save time

Time:2022-5-7

Python is a beautiful language that can inspire users to love it. So if you’re trying to join the ranks of programmers, or if you’re a little tired of C + +, Perl, Java and other languages, I recommend you try python

Python has many features that attract programmers. It is easy to learn, object-oriented, bytecode compilation, free and open source. There are also runtime checks. Complete and fast support, which can perform the expansion of various tasks.

Efficient Python

In this article, I want to highlight some aspects of python that can save time and maximize productivity. In preparation, I consulted several pythonists. What are their most time-saving skills? The answer is here

1. Do not use semicolons

Using semicolons is optional in Python. Compared with other object-oriented languages, you don’t need to use semicolons after every statement.

This seems simple and doesn’t seem to save much time; But once your code expands to thousands of semicolons, these semicolons become distracted and don’t have to be typed.

2. Find a code editor called hand

Choosing a code editor that weighs hands can save a lot of time. Faced with so many code editors, many novices will feel very confused.

Getting used to one editor and then using other editors will feel very confused, so choosing a hand is a good starting point. Whichever you choose, support in real timeflake8andPEP8

For editor selection guide, please refer to the articleWhich Code Editors Do Pythonists Use?

3. Follow Python code specification

10 ways Python developers can save time

Follow PythonCode specificationIt can improve the readability of the code and save the time of reviewing the code. (Python)Design philosophyEmphasize the readability of the code.)

4. Use the help() function

Python’s help () is a built-in function that is readily available, which can save a lot of time, such as finding the explanation of other functions. You can run this function directly at the interpreter terminal.

Python documentationThere are more uses of this function.

5. Use library

Python has a large number of libraries that allow you to avoid having to build wheels every time.

For example, you canPyPI(Python package index) select a large number of available packages, which is a software warehouse.

10 ways Python developers can save time

Scikit-imageIs a good example. It makes image processing tasks such as blur, contrast enhancement and scaling only need some function calls.

6. Use cookiecutter

10 ways Python developers can save time

CookiecutterIs a command line tool that can help you create Python projects from project templates, which can save a lot of time.

7. Strict notes

Developing the good habit of writing comments can save you and others time, especially debugging and tracking. Yes, we hear a lot, but it seems that many programmers still need to be reminded.

10 ways Python developers can save time

Annotation is very critical in teamwork, especially one that has made a lot of changes.

8. Regular testing

Try to test every component in your program. It sounds like you can save yourself a lot of time when you run the code, but it takes you a lot of time to find the real bug.

REPLIt is a read Eval print loop, a common code testing tool, which is used by many pythonists.

9. Focus and professionalism

10 ways Python developers can save time

Pythonists all recommend having a focus area and expertise. You can use Python to do a lot of things, from writing web videos to processing calculations and algorithms.

There are already a large number of libraries that can help accomplish these tasks, such asSimpleCV, computer vision processing;Biopython, is a biological computing library;SymPy, is a mathematical symbol calculation library.

Go deep into areas like these and master a specific framework to help you learn Python at a deeper level, master a specific code style (mentioned in the third part) and deal with specific types of problems.

10. Daily coding

When you get into the habit of writing Python code every day and using Python to solve problems, you will start thinking in Python, which will eventually help you solve problems faster.

summary

In this short article, I have listed the main tips I collected from conversations with Python developers. Here are other tips I can add

Participate in Python activities and gatherings

10 ways Python developers can save time

Be sure to attend every event and assembly you can attend. They are useful for sharing experiences, best practices, tools and other interesting topics.

This may not be an easy strategy on the surface, but learning from others’ experience through suggestions, hints and cracking is another way to avoid repeated wheel building.

Once a yearPyConfIt’s a good place to know about activities.

Think on paper

Thinking on paper – before going straight into the code – will give you the flexibility to make changes. Writing code directly forces you to consider implementation details from the beginning, which is often not the best use of your time when starting a project. Thinking on paper is a way to free your attention, which is good for brainstorming and problem solving!

Master basic knowledge

This last one seems obvious, but you must invest time in learning the basics of Python This will eventually save you a lot of time, because you will be better prepared for more complex topics

Some good books can help, including:

It is also important to keep relevant information fresh by reading blogs and articles. A great blog to follow up on isThe Mouse Vs. The Python.

Original link:10 Time-saving Tips for Pythonists

Reprinted from:10 ways Python developers can save time

This work adoptsCC agreement, reprint must indicate the author and the link to this article

Recommended Today

Java exception

I abnormal concept Abnormal conditions during the execution of the program will eventually lead to the abnormal stop of the JVM. The error is not an exception, but a problem out of the control of the programmer. arrangement The exception class is the father of all exception classes.Java programs usually do not catch errors. Errors […]