python--statements with higher precedence than return

Source: Internet
Author: User
Tags finally block

Call Sqlmap, when using Sqlmap to do two times development, the problem arises:

Return in call Sqlmap, however, the main program will be interrupted by some code in the Sqlmap.

Adding a try also does not block interrupts.

Later guessing that the interruption was caused by exit, search exit, really found that after the return, some of the following code will also run, in the finally block--finally priority is higher than return.

def finallytest ():     Try :         return 1    except:        pass    finally:         return 2print  finallytest ()#resule:2

Finally the priority will be higher than the return in the try, even if the try has already been return, finally will be executed, finally the return will overwrite the return in the try.

So, return is not easy to rest, if you are in the try, but also careful finally to tamper with.

python--statements with higher precedence than return

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.