{ "cells": [ { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "import asyncio\n", "\n", "async def inf(s, start=0):\n", " i = start\n", " while True:\n", " await asyncio.sleep(s)\n", " yield i\n", " i += 1" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "c1 = inf(0.1)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "c2 = inf(1.0)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "c3 = c2 + 1" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "[c2]-ad9891880f46e6741a1d\n", "\n", "[c2]-ad9891880f46e6741a1d\n", "\n", "\n", "\n", "[c3]-815cca01c6f807222b5d\n", "\n", "[c3]-815cca01c6f807222b5d\n", "\n", "\n", "\n", "[c2]-ad9891880f46e6741a1d--[c3]-815cca01c6f807222b5d\n", "\n", "\n", "\n", "\n", "[b]-ca7880b7ef60b12fe563\n", "\n", "[b]-ca7880b7ef60b12fe563\n", "\n", "\n", "\n", "[a]-5a33b7e71c65becc01ef\n", "\n", "[a]-5a33b7e71c65becc01ef\n", "\n", "\n", "\n", "[b]-ca7880b7ef60b12fe563--[a]-5a33b7e71c65becc01ef\n", "\n", "\n", "\n", "\n", "[inf]+[asyncio]-f542604080df168f7d69\n", "\n", "[inf]+[asyncio]-f542604080df168f7d69\n", "\n", "\n", "\n", "[inf]+[asyncio]-f542604080df168f7d69--[c2]-ad9891880f46e6741a1d\n", "\n", "\n", "\n", "\n", "[c1]-a0ea85450f66645c4b23\n", "\n", "[c1]-a0ea85450f66645c4b23\n", "\n", "\n", "\n", "[inf]+[asyncio]-f542604080df168f7d69--[c1]-a0ea85450f66645c4b23\n", "\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "cell_dependency_graph()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "10" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "b = 10" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "20" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "a = b + 10" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Reactive Python", "language": "python", "name": "reactivepy" }, "language_info": { "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "version": "3.6.6" } }, "nbformat": 4, "nbformat_minor": 2 }