from itertools import cycle, count
def derailleur(counter, carousel):
if not carousel:
return counter
return carousel
def main():
carousel = cycle([0,0,'Fizz',0,'Buzz','Fizz',0,0,'Fizz','Buzz',0,'Fizz',0,0,'FizzBuzz'])
counter = count(1)
f = map(print, map(derailleur, counter, carousel))
while 1:
next(f)
main()
from itertools import cycle, count
def derailleur(counter, carousel):
if not carousel:
return counter
return carousel
def main():
carousel = cycle([0,0,'Fizz',0,'Buzz','Fizz',0,0,'Fizz','Buzz',0,'Fizz',0,0,'FizzBuzz'])
counter = count(1)
f = map(print, map(derailleur, counter, carousel))
while 1:
next(f)
main()
user@Desktop:~$ python3 fizzbuzz.py | pv > /dev/null
^C21MiB 0:00:30 [14,2MiB/s] [ <=> ]
Traceback (most recent call last):
File "fizzbuzz.py", line 15, in <module>
main()
File "fizzbuzz.py", line 13, in main
next(f)
File "fizzbuzz.py", line 3, in derailleur
def derailleur(counter, carousel):
KeyboardInterrupt
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
user@Desktop:~$ pypy3 fizzbuzz.py | pv > /dev/null
^C57MiB 0:00:30 [25,0MiB/s] [ <=> ]
Traceback (most recent call last):
File "fizzbuzz.py", line 15, in <module>
main()
File "fizzbuzz.py", line 13, in main
next(f)
KeyboardInterrupt
user@Desktop:~$ python3 fizzbuzz.py | pv > /dev/null
^C21MiB 0:00:30 [14,2MiB/s] [ <=> ]
Traceback (most recent call last):
File "fizzbuzz.py", line 15, in <module>
main()
File "fizzbuzz.py", line 13, in main
next(f)
File "fizzbuzz.py", line 3, in derailleur
def derailleur(counter, carousel):
KeyboardInterrupt
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
user@Desktop:~$ pypy3 fizzbuzz.py | pv > /dev/null
^C57MiB 0:00:30 [25,0MiB/s] [ <=> ]
Traceback (most recent call last):
File "fizzbuzz.py", line 15, in <module>
main()
File "fizzbuzz.py", line 13, in main
next(f)
KeyboardInterrupt
from itertools import cycle, count
def derailleur(counter, carousel):
if not carousel:
return counter
return carousel
def main():
carousel = cycle([0,0,'Fizz',0,'Buzz','Fizz',0,0,'Fizz','Buzz',0,'Fizz',0,0,'FizzBuzz'])
counter = map(str, count(1))
f = map(derailleur, counter, carousel)
while 1:
print('\n'.join([next(f) for _ in range(256)]))
main()
from itertools import cycle, count
def derailleur(counter, carousel):
if not carousel:
return counter
return carousel
def main():
carousel = cycle([0,0,'Fizz',0,'Buzz','Fizz',0,0,'Fizz','Buzz',0,'Fizz',0,0,'FizzBuzz'])
counter = map(str, count(1))
f = map(derailleur, counter, carousel)
while 1:
print('\n'.join([next(f) for _ in range(256)]))
main()
user@Desktop:~$ python3 chunking_fizzbuzz.py | pv > /dev/null
^C84MiB 0:00:30 [19,6MiB/s] [ <=> ]
Traceback (most recent call last):
File "chunking_fizzbuzz.py", line 15, in <module>
main()
File "chunking_fizzbuzz.py", line 13, in main
print('\n'.join([next(f) for _ in range(256)]))
KeyboardInterrupt
user@Desktop:~$ pypy3 chunking_fizzbuzz.py | pv > /dev/null
^C49GiB 0:00:30 [84,9MiB/s] [ <=> ]
Traceback (most recent call last):
File "chunking_fizzbuzz.py", line 15, in <module>
main()
File "chunking_fizzbuzz.py", line 13, in main
print('\n'.join([next(f) for _ in range(256)]))
File "chunking_fizzbuzz.py", line 13, in <listcomp>
print('\n'.join([next(f) for _ in range(256)]))
KeyboardInterrupt
user@Desktop:~$ python3 chunking_fizzbuzz.py | pv > /dev/null
^C84MiB 0:00:30 [19,6MiB/s] [ <=> ]
Traceback (most recent call last):
File "chunking_fizzbuzz.py", line 15, in <module>
main()
File "chunking_fizzbuzz.py", line 13, in main
print('\n'.join([next(f) for _ in range(256)]))
KeyboardInterrupt
user@Desktop:~$ pypy3 chunking_fizzbuzz.py | pv > /dev/null
^C49GiB 0:00:30 [84,9MiB/s] [ <=> ]
Traceback (most recent call last):
File "chunking_fizzbuzz.py", line 15, in <module>
main()
File "chunking_fizzbuzz.py", line 13, in main
print('\n'.join([next(f) for _ in range(256)]))
File "chunking_fizzbuzz.py", line 13, in <listcomp>
print('\n'.join([next(f) for _ in range(256)]))
KeyboardInterrupt