This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This fifo can be used if you have a generator that may modify objects already yielded | |
def fifo(generator, size): | |
buf=[] | |
for item in generator: | |
if len(buf) == size: | |
yield buf.pop(0) | |
buf.append(item) | |
for item in buf: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
#encoding=utf-8 | |
# Copyright (c) 2014, Mikael Lövqvist | |
# All rights reserved. | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are met: | |
# * Redistributions of source code must retain the above copyright | |
# notice, this list of conditions and the following disclaimer. |