Python's nesting function for stepping on pits

Source: Internet
Author: User

It is important to note that Python is the language of the interpretation type. Allows function A to call function B without defining a B function before defining a function.

def func1():    print"Hello fun1"    fun2()def func2():    print"Hello func2"fun1()

It is possible to do so. But imagine if function 2 also calls function 1?

As follows:

def func1():    print"Hello fun1"    fun2()def func2():    print"Hello func2"    fun1()fun1()

This is a nested call. Will explode the stack of ...
Because it is not a compiled language, this problem is difficult to pre-parse the syntax, it is likely that python in order to pursue speed, not to analyze the error.
So when writing a program, pay special attention to not nesting calls between two or more functions ...
Of course, I didn't do it, I just tried it, so python can actually nest defined functions.

Python's nesting function for stepping on pits

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: info-contact@alibabacloud.com 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.