Tekkaman

导航

 

[partial function]

  functools.partial(func[,*args][, **keywords])

  Return a new partial object which when called will behave like func called with the positional arguments args and keyword arguments keywords. If more arguments are supplied to the call, they are appended to args. If additional keyword arguments are supplied, they extend and override keywords. Roughly equivalent to:

  

  The partial() is used for partial function application which “freezes” some portion of a function’s arguments and/or keywords resulting in a new object with a simplified signature. For example, partial() can be used to create a callable that behaves like the int() function where the base argument defaults to two:

  

 参考: http://docs.python.org/2.7/library/functools.html

posted on 2013-11-28 16:07  Tekkaman  阅读(530)  评论(0编辑  收藏  举报