理解functools.partial()

  • functools

    functools : Higher-order functions and operations on callable objects.

  • functools.partial(func,/,*args,**keywords)

    Return a new partial object which when called will hehave like func called with the positional arguments args and keyword arguments keywords.

    Is used for partial function application which “freezes” some portion of a function’s arguments and/or keywords resulting in a new object with s simplified signature.

  • partial Objects

    partial objects are callable objects created by partial(). They have three read-only attributes:

    partial.func

    partial.args

    partial.keywords

你可能感兴趣的:(#,小白学Python,functools,partial)