Project

General

Profile

« Previous | Next » 

Revision 1373

util.py: none_if(): Allow multiple none_vals using varargs

View differences:

lib/util.py
45 45
    if val == None: return val
46 46
    else: return do(val)
47 47

  
48
def none_if(val, none_val):
49
    if cast(type(none_val), val) == none_val: return None
50
    else: return val
48
def none_if(val, *none_vals):
49
    for none_val in none_vals:
50
        if cast(type(none_val), val) == none_val: return None
51
    return val
51 52

  
52 53
#### Iterables
53 54

  

Also available in: Unified diff