IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
6.6.1 partial Objects


6.6.1 partial Objects

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

func
A callable object or function. Calls to the partial object will be forwarded to func with new arguments and keywords.

args
The leftmost positional arguments that will be prepended to the positional arguments provided to a partial object call.

keywords
The keyword arguments that will be supplied when the partial object is called.

partial objects are like function objects in that they are callable, weak referencable, and can have attributes. There are some important differences. For instance, the __name__ and __doc__ attributes are not created automatically. Also, partial objects defined in classes behave like static methods and do not transform into bound methods during instance attribute look-up.

See About this document... for information on suggesting changes.