Python inner function parameter shadowed

Daiyue Weng daiyueweng at gmail.com
Tue Sep 13 12:34:14 EDT 2016


Hi, I am using inner function like this,

def timeit(func=None, loops=1, verbose=False):
    if func is not None:
        def inner(*args, **kwargs):

            # some code

        return inner
    else:
        def partial_inner(func):
            return timeit(func, loops, verbose)

        return partial_inner


PyCharm warns about "Shadows name 'func' from outer scope" on

def partial_inner(func):

How to fix it?

cheers



More information about the Python-list mailing list