python-ast-explorer icon indicating copy to clipboard operation
python-ast-explorer copied to clipboard

Add support for python3

Open Daenyth opened this issue 6 years ago • 2 comments

Type annotations for example just give an error

Daenyth avatar Jun 19 '18 17:06 Daenyth

@Daenyth @maligree @ivan111 cpython-3.7.4/Lib/test/test_asyncio/utils.py this code can compile in python3.74

def _run_test_server(*, address, use_ssl=False, server_cls, server_ssl_cls):

    def app(environ, start_response):
        status = '200 OK'
        headers = [('Content-type', 'text/plain')]
        start_response(status, headers)
        return [b'Test message']
    server_class = server_ssl_cls if use_ssl else server_cls
    httpd = server_class(address, SilentWSGIRequestHandler)
    httpd.set_app(app)
    httpd.address = httpd.server_address
    server_thread = threading.Thread(target=lambda : httpd.serve_forever(
        poll_interval=0.05))
    server_thread.start()
    try:
        yield httpd
    finally:
        httpd.shutdown()
        httpd.server_close()
        server_thread.join()

QGB avatar Apr 22 '21 07:04 QGB

I find it very useful when understanding some weird code, usually with newly introduced syntax.

The only problem is that the Python version it supported is too outdated.

It would be great if the website backend is upgraded.

Gowee avatar Jun 17 '21 06:06 Gowee