[Python-ideas] Addition to operator module: starcaller

Daniel Spitz spitz.dan.l at gmail.com
Thu Jul 21 10:06:51 EDT 2016


I have run into a use case where I want to create a wrapper object that
will star-unpack a sequence of arguments to pass to a function. Currently
one way to construct this is to create a function:

def starcaller(f):
    def wrapper(args):
        return f(*args)
    return wrapper

Such a function feels simple enough, and specific enough to the language,
that it would fit in well in the operator module of the standard library.
We already have a similar representation of this functionality in

Whereas the nested function implementation above will produce unpickleable
objects (due to the closure), a straightforward c implementation will
produce pickleable ones, making them useful for parallel applications.

Dan Spitz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160721/419a6faa/attachment.html>

More information about the Python-ideas mailing list