Python Testing and debugging Tips

Source: Internet
Author: User

Testing and debugging Tips 2.1 Entering a python statement in interactive mode executes one. This mode is especially useful when you are debugging a program.

Test and Debug Tip 2.2 after a file invokes the Python interpreter, the interpreter is launched after the last statement in the file is executed. However, using the-I option (for example, Python-i to invoke the interpreter on a file causes the compiler to enter interactive mode after executing the statements in the file. This is very useful for debugging the program.

Testing and debugging Tips 2.3 If an expression contains many operators, be sure to refer to the Operator precedence table, and the operators in the appropriate expression execute in the order that they want them to, such as the expression is too complex to determine the order, you may want to split the expression into several small statements, Or simply use parentheses to dictate the order--the same approach can be used in algebraic expressions. Note that some operators (such as the exponentiation operator * *) are associated in a right-to-left order, not from left to right.

Test and debug tip 2.4 to avoid imperceptible errors, be sure to use uniform and correct indentation in your Python program.

Python Testing and debugging Tips

Related Article

Contact Us

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: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.