2014-03-30 13:21:28 -04:00
|
|
|
# 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()))
|
2014-06-11 13:22:30 -04:00
|
|
|
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")))
|