Project

General

Profile

« Previous | Next » 

Revision 1008

util.py: Added list_get()

View differences:

lib/util.py
63 63
        if self.check_func(entry): return entry
64 64
        else: raise ConstraintError(self.check_func, entry)
65 65

  
66
#### Lists
67

  
68
def list_get(list_, idx, default=None):
69
    try: return list_[idx]
70
    except IndexError: return default
71

  
66 72
#### Dicts
67 73

  
68 74
def rename_key(dict_, orig, new): dict_[new] = dict_.pop(orig)

Also available in: Unified diff