Project

General

Profile

« Previous | Next » 

Revision 133

map: Continued to add DB input support

View differences:

util.py
1 1
# Useful functions and classes
2 2

  
3
def skip(iter_, func):
4
    # Advance iter while func is True
5
    try:
6
        while func(iter_.curr()): iter_.next()
7
    except StopIteration: pass # nothing after the matching elements
8

  
3 9
def rename_key(dict_, orig, new):
4 10
    try: dict_[new] = dict_.pop(orig)
5 11
    except KeyError: pass

Also available in: Unified diff