Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def mp_instance_method(args, **kwargs):
- callable_ = getattr(args[1].__class__, args[0])
- return callable_(*args[1:], **kwargs)
- if __name__ == '__main__':
- s = "abcdef"
- pool = multiprocessing.Pool()
- args = zip([str.capitalize.__name__] * len(s), s)
- result = pool.map_async(mp_instance_method, args)
- us = result.get()
- pool.close()
- pool.join()
Add Comment
Please, Sign In to add comment