PythonExtra/tests/basics/generator_args.py
Damien George 539681fffd tests: Rename test scripts, changing - to _ for consistency.
From now on, all new tests must use underscore.

Addresses issue #727.
2014-07-05 06:14:29 +01:00

18 lines
354 B
Python

# Handling of "complicated" arg forms to generators
# https://github.com/micropython/micropython/issues/397
def gen(v=5):
for i in range(v):
yield i
print(list(gen()))
print(list(gen(v=10)))
def g(*args, **kwargs):
for i in args:
yield i
for k, v in kwargs.items():
yield (k, v)
print(list(g(1, 2, 3, foo="bar")))