> On Sep 13, 2016, at 8:58 PM, Lawrence D’Oliveiro
> wrote:
>
>> On Wednesday, September 14, 2016 at 4:34:34 AM UTC+12, Daiyue Weng wrote:
>> PyCharm warns about "Shadows name 'func' from outer scope"
>
> Typical piece of software trying to be too helpful and just getting in the
> way.
>
> Ca
On Wednesday 14 September 2016 13:58, Lawrence D’Oliveiro wrote:
> On Wednesday, September 14, 2016 at 4:34:34 AM UTC+12, Daiyue Weng wrote:
>> PyCharm warns about "Shadows name 'func' from outer scope"
>
> Typical piece of software trying to be too helpful and just getting in the
> way.
>
> Can
On Wednesday, September 14, 2016 at 4:34:34 AM UTC+12, Daiyue Weng wrote:
> PyCharm warns about "Shadows name 'func' from outer scope"
Typical piece of software trying to be too helpful and just getting in the way.
Can you turn off such warnings?
--
https://mail.python.org/mailman/listinfo/pytho
Yeah, you could change the name, but it shouldn't matter, the "func" in the
inner function will always be the one passed into it, it won't be the
"func" from the outer function, which in this specific case, would always
be None (at least as far as the second inner function is concerned.)
On Tue, S
On Wed, Sep 14, 2016 at 4:28 AM, Brendan Abel <007bren...@gmail.com> wrote:
> This looks like a decorator function that optionally accepts arguments to
> change the behavior.
Oh, I get it. So, yeah, it is one function doing two jobs -
legitimately. In that case, I'd just rename one of the 'func'
a
This looks like a decorator function that optionally accepts arguments to
change the behavior.
You can safely ignore the warning form PyCharm. the variable won't be
shadowed it's included in the function signature of the inner function.
A lot of times, the outside decorator will just use the *ar
On Wed, Sep 14, 2016 at 2:34 AM, Daiyue Weng wrote:
> 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_
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)
re