2014-07-07 17:50 GMT+02:00 Guido van Rossum <[email protected]>:
> I'm not sure actually. Does Task have any public methods that it doesn't
> inherit from Future? I think the more fundamental *interface* is Future,
> while Task (mostly) provides a specific implementation.

Task has more attributes: _coro, _fut_waiter, _log_destroy_pending. It
has more methods: get_stack(), print_stack(), _step(), _wakeup(). At
least, get_stack() and print_stack() are public.

It looks like private attributes and methods of Task are ony used in
the Task class (as expected).

Task has more features, especially in debug mode: repr(Task) and Task
destructor are more useful in debug mode than the same methods of the
Future class. I mean that if the Task is enhanced, projects with their
custom class inheriting from Task will benefit of that.

I don't want to make inheriting Task mandatory, but it's just "better" :-)

Or do you think that we must add some "assert isinstance(task,
asyncio.Future)"? (No duck typing)

Victor

Reply via email to