python BaseManager中register()的描述

 1 register(typeid[, callable[, proxytype[, exposed[, method_to_typeid[, create_method]]]]])
 2 
 3     A classmethod which can be used for registering a type or callable with the manager class.
 4 
 5     typeid is a “type identifier” which is used to identify a particular type of shared object. This must be a string.
 6 
 7     callable is a callable used for creating objects for this type identifier. If a manager instance will be created using the from_address() classmethod or if the create_method argument is False then this can be left as None.
 8 
 9     proxytype is a subclass of BaseProxy which is used to create proxies for shared objects with this typeid. If None then a proxy class is created automatically.
10 
11     exposed is used to specify a sequence of method names which proxies for this typeid should be allowed to access using BaseProxy._callmethod(). (If exposed is None then proxytype._exposed_ is used instead if it exists.) In the case where no exposed list is specified, all “public methods” of the shared object will be accessible. (Here a “public method” means any attribute which has a __call__() method and whose name does not begin with '_'.)
12 
13     method_to_typeid is a mapping used to specify the return type of those exposed methods which should return a proxy. It maps method names to typeid strings. (If method_to_typeid is None then proxytype._method_to_typeid_ is used instead if it exists.) If a method’s name is not a key of this mapping or if the mapping is None then the object returned by the method will be copied by value.
14 
15     create_method determines whether a method should be created with name typeid which can be used to tell the server process to create a new shared object and return a proxy for it. By default it is True.
原文地址:https://www.cnblogs.com/liunnis/p/4614781.html