from __future__ import print_function def method_from_odoo(meth): print(meth()) # Good case if it was used one time and is not used anymore. MY_LIST = [] def method_pylint_think_is_used(meth): MY_LIST.append(meth) # Wrong case if it is stored to use after. def cases(): """Closing over a loop variable.""" for i in range(10): method_from_odoo(lambda: i) method_pylint_think_is_used(lambda: i) cases() # bad case if you use the meth after, because it will have the same value in all lambda methods. print([meth() for meth in MY_LIST]) # Results: # 0 # 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # [9, 9, 9, 9, 9, 9, 9, 9, 9, 9]