Hi, I try to get a set of lambda functions that allows me executing each function code exactly once. Therefore, I would like to modify the set function to compare the func_code properties (or the lambda functions to use this property for comparison).
(The reason is that the real function list is quite large (> 1E5), there are only few functions with non-equal code and the order of execution is not important.) How can I achieve this? >>> func_strings=['x', 'x+1', 'x+2', 'x'] >>> funclist = [eval('lambda x:' + func) for func in func_strings] >>> len(funclist) 4 >>> len(set(funclist)) 4 >>> funclist[0].func_code == funclist[3].func_code True >>> funclist[0] == funclist[3] False Thanks in advance Martin -- http://mail.python.org/mailman/listinfo/python-list