2014/1/23 Guido van Rossum <[email protected]>: > This is a good point. It made more sense in the early days when I > wanted to avoid importing modules that you don't need. But __init__.py > imports them all anyways. So go ahead and change this in the tests.
Ok, I modified most tests to use the asyncio module. There are remaining "from asyncio import ..." because some symbols are not exported. I think that the following symbols should be exported: - base_events module: BaseEventLoop - selector_events: BaseSelectorEventLoop - proactor_events: BaseProactorEventLoop - queues: Queue, LifoQueue, PriorityQueue, JoinableQueue I don't know if the following symbols should be exported: - constants: ACCEPT_RETRY_DELAY, LOG_THRESHOLD_FOR_CONNLOST_WRITES - queues: Empty, Full - log: logger - windows_events: PipeServer - unix_events: BaseChildWatcher I think that the following symbols should NOT be exported: - events: make_handle() -> I proposed a patch to drop this function (Handle is already exported) http://code.google.com/p/tulip/issues/detail?id=112 - selector_events: _SelectorTransport, _SelectorSslTransport, _SelectorSocketTransport, _SelectorDatagramTransport - proactor_events: _ProactorSocketTransport, _ProactorWritePipeTransport, _ProactorDuplexPipeTransport - unix_events: _UnixReadPipeTransport, _UnixWritePipeTransport _overlapped, test_utils, selectors and windows_utils are still imported with "from asyncio import <module>", but I prefer to keep this syntax. > (However, inside the asyncio package, please don't use "import > asyncio" -- recursive imports cause all kinds of things to break even > if it seems to work find when you try it.) Sure. Current list of exported symbols: >>> pprint.pprint(dir(asyncio)) ['ALL_COMPLETED', 'AbstractChildWatcher', 'AbstractEventLoop', 'AbstractEventLoopPolicy', 'AbstractServer', 'BaseProtocol', 'BaseTransport', 'BoundedSemaphore', 'CancelledError', 'Condition', 'DatagramProtocol', 'DatagramTransport', 'DefaultEventLoopPolicy', 'Event', 'FIRST_COMPLETED', 'FIRST_EXCEPTION', 'FastChildWatcher', 'Future', 'Handle', 'InvalidStateError', 'Lock', 'Protocol', 'ReadTransport', 'STDERR', 'STDIN', 'STDOUT', 'SafeChildWatcher', 'SelectorEventLoop', 'Semaphore', 'StreamReader', 'StreamReaderProtocol', 'StreamWriter', 'SubprocessProtocol', 'SubprocessTransport', 'Task', 'TimeoutError', 'TimerHandle', 'Transport', 'WriteTransport', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__initializing__', '__loader__', '__name__', '__package__', '__path__', 'as_completed', 'async', 'base_events', 'base_subprocess', 'constants', 'coroutine', 'events', 'futures', 'gather', 'get_child_watcher', 'get_event_loop', 'get_event_loop_policy', 'iscoroutine', 'iscoroutinefunction', 'locks', 'log', 'new_event_loop', 'open_connection', 'protocols', 'selector_events', 'selectors', 'set_child_watcher', 'set_event_loop', 'set_event_loop_policy', 'shield', 'sleep', 'start_server', 'streams', 'sys', 'tasks', 'transports', 'unix_events', 'wait', 'wait_for', 'wrap_future'] Victor
