"Go" python3.x remove callable built-in functions

Source: Internet
Author: User

Original address: http://www.cnblogs.com/elvisxu/archive/2010/10/26/1861958.html

When I recently learned Python, I ran "Dive into Python" as an example in Python3, and found the error in calling the callable () function times:

Nameerror:name ' callable ' is not defined

Online check found that Python3 has removed this built-in function. Check out Python v3.0 documentation discovery can be used

The Hasattr (object, name) built-in function accomplishes the callable function in the following way:

3.0 Before: Callable (func)

After 3.0: Hasattr (func, ' __call__ ')

The two results are the same.

Note: With the callable () function, we can tell if an object is a callable object.

Callable () Specific meanings can be found in: http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/ 0013946328809098c1be08a2c7e4319bd60269f62be04fa000

"Go" python3.x remove callable built-in functions

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: 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.