Skip to content

Instantly share code, notes, and snippets.

@satomacoto
Last active December 15, 2015 08:59
Show Gist options
  • Save satomacoto/5235171 to your computer and use it in GitHub Desktop.
Save satomacoto/5235171 to your computer and use it in GitHub Desktop.
Test parameters
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
try some parameters.
$ python params_test.py
[0, -1]
False
[0, 0]
False
[0, 1]
False
[1, -1]
True
[1, 0]
False
[1, 1]
True
'''
import itertools
# [0,1,2] to func(x) = x
# [0,1,2,3] to func(x) = x-1
func_list = [lambda x: x, lambda x: x-1] # functions
params_lists = [range(2), range(3)] # parameters
for params_list in itertools.product(*params_lists):
print [func(params) for func, params in zip(func_list, params_list)]
print all(func(params) for func, params in zip(funcs_list, params_list))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment