A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-February/085877.html below:

[Python-Dev] Missing operator.call

[Python-Dev] Missing operator.call"Martin v. Löwis" martin at v.loewis.de
Wed Feb 4 20:48:03 CET 2009
> If there is interest in this and no reason why it shouldn't be done, I
> can write up an issue in the tracker and provide a patch.

I think there is a tricky design choice to make wrt. argument passing.
IIUC, you don't care much about arguments, so you could probably live
with

def call(o):
    return o()

Somebody proposed that you pass arguments once, and get an
"arguments bound" object, i.e.

def call(*args, **kwds):
    def func(o):
        return o(*args, **kwds)
    return func

Finally, it seems that Guido is advocating an API where arguments get
passed along with the callable, i.e.

def call(o, *args, **kwds):
    return o(*args, **kwds)

which would make call a synonym for apply (and would also provide for
the first definition as a special case). However, with that API, it
isn't so easy anymore to pass the same arguments to all callables
(unless it is no arguments that you want to pass).

Regards,
Martin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4