import asyncio
from rx import Observable


async def hello_world():
    stream = Observable.just("Hello, world!")
    n = await stream
    print(n)

loop = asyncio.get_event_loop()
# Blocking call which returns when the hello_world() coroutine is done
loop.run_until_complete(hello_world())
loop.close()

import asyncio
from rx import Observable


stream = Observable.just("Hello, world!")

async def hello_world():
    n = await stream
    print(n)

loop = asyncio.get_event_loop()
# Blocking call which returns when the hello_world() coroutine is done
loop.run_until_complete(hello_world())
loop.close()

Move stream out of function
Move stream out of function

  import asyncio
  from rx import Observable
  
  
+ stream = Observable.just("Hello, world!")
+ 
  async def hello_world():
-     stream = Observable.just("Hello, world!")
      n = await stream
      print(n)
  
  loop = asyncio.get_event_loop()
  # Blocking call which returns when the hello_world() coroutine is done
  loop.run_until_complete(hello_world())
  loop.close()
  
Move stream out of function
## Code Before:
import asyncio
from rx import Observable


async def hello_world():
    stream = Observable.just("Hello, world!")
    n = await stream
    print(n)

loop = asyncio.get_event_loop()
# Blocking call which returns when the hello_world() coroutine is done
loop.run_until_complete(hello_world())
loop.close()

## Instruction:
Move stream out of function
## Code After:
import asyncio
from rx import Observable


stream = Observable.just("Hello, world!")

async def hello_world():
    n = await stream
    print(n)

loop = asyncio.get_event_loop()
# Blocking call which returns when the hello_world() coroutine is done
loop.run_until_complete(hello_world())
loop.close()
