Revision 1373
Added by Aaron Marcuse-Kubitza almost 13 years ago
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
util.py: none_if(): Allow multiple none_vals using varargs