[Python-ideas] Async API: some code to review

Andrew Svetlov andrew.svetlov at gmail.com
Mon Oct 29 21:03:12 CET 2012

I mean just something like:

    def call_soon(__self, __callback, *__args, **__kwargs):
        dcall = DelayedCall(None, __callback, __args, __kwargs)
        return dcall

Not big deal, through. We can delay this discussion for later.

On Mon, Oct 29, 2012 at 9:54 PM, Guido van Rossum <guido at python.org> wrote:
> On Mon, Oct 29, 2012 at 12:24 PM, Andrew Svetlov
> <andrew.svetlov at gmail.com> wrote:
>> On Mon, Oct 29, 2012 at 8:10 PM, Guido van Rossum <guido at python.org> wrote:
> [Andrew]
>>>> I would to see add_{reader,writer} and call_{soon,later} accepting
>>>> **kwargs as well as *args. At least to respect functions with
>>>> keyword-only arguments.
>>> Hmm... I intentionally ruled those out because I wanted to leave the
>>> door open for keyword args that modify the registration function
>>> (add_reader etc.); it is awkward to require conventions like "your
>>> function cannot have a keyword arg named X because we use that for our
>>> own API" and it is even more awkward to have to retrofit new values of
>>> X into that rule. Maybe we can come up with a simple wrapper.
>> It can be solved easy with using names like __when, __callback etc.
>> That names will never clutter with user provided kwargs I believe.
> No, those names have different meaning inside a class (they would be
> transformed into _<class>__when, where <class> is the name of the
> *current* class textually enclosing the use). I am not closing the
> door on this one but I'd have to see a lot more evidence that this
> issue is widespread.
> --
> --Guido van Rossum (python.org/~guido)

Andrew Svetlov

More information about the Python-ideas mailing list