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.
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.
For editor selection guide, please refer to the articleWhich Code Editors Do Pythonists Use?
3. Follow Python code specification
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.
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
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.
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
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.
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
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.
This work adoptsCC agreement, reprint must indicate the author and the link to this article