May-01-2024, 05:35 AM
Thanks for the reply.
The problem is probably Idle. When I do this in Idle,
The problem is probably Idle. When I do this in Idle,
def actor(func): # this will not print #print(f'key in _registry is {func.__name__}') def wrapper(*args, **kwargs): gen = func(*args, **kwargs) next(gen) _registry[func.__name__] = gen print(f'key in _registry is {func.__name__}') return wrapper printerQ() None n = 10 while n > 0: send('printerQ', n) n -= 1I get:
Output:printer: 10
printer: 9
printer: 8
printer: 7
printer: 6
printer: 5
printer: 4
printer: 3
printer: 2
printer: 1
But in bash it prints:Output:pedro@pedro-HP:~/myPython/yield/tutorial2014$ ./actor1.py
key in _registry is printer
printer: 10
printer: 9
printer: 8
printer: 7
printer: 6
printer: 5
printer: 4
printer: 3
printer: 2
printer: 1
Should have tried it in bash as well!