GithubHelp home page GithubHelp logo

Comments (4)

Zheaoli avatar Zheaoli commented on May 29, 2024 2

那么方法呢(在官方语境里, Method 和 function 指代的不一样噢,虽然在 3.0 之后,取消了 bound method 的概念,但是含义还是不一样的)

另外类也不一定能作为装饰器的的,必须是定义了 __call__ 的方法,换句话讲,是 callable 的

所以还是建议 callable object 代替比较好((

from python_interview_question.

kenwoodjw avatar kenwoodjw commented on May 29, 2024

把一个函数当参数传到另一个函数中,然后再回调

from python_interview_question.

Zheaoli avatar Zheaoli commented on May 29, 2024

类装饰器了解下

装饰器可以用类/fucntion/method 来做,并不是仅限于某一个函数,所以一直都是 callable object

from python_interview_question.

kenwoodjw avatar kenwoodjw commented on May 29, 2024

装饰器本质上是一个python函数或类

from python_interview_question.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.