Zane Bitter <za...@fedoraproject.org> added the comment:

> It feels wrong to do this as a band-aid to help out people who didn't do the 
> right thing.

I mean... are we here to punish people for making mistakes by sending them to 
schroedinbug purgatory, or are we here to help them upgrade to the latest 
Python without feeling like it's a minefield?

I genuinely don't know what Python's stance on this is. Certainly the Linux 
kernel and Windows both have a philosophy of not breaking working userspace 
code no matter how wrong it might be, so it's not unheard-of to choose the 
latter.

I suggested on the PR that we could deprecate the setter so that people who are 
Doing It Wrong will get a warning that they can much more easily track down and 
fix, and we won't encourage any wrong new code. Would that change your opinion?

> > but the good news is that the values are now cached

> That's not relevant to the performance numbers I posted above, is it?

Not directly - your performance numbers show that accessing the attribute is 
~300ns slower when it's a property. But the thing that gets called all the time 
that we want to be fast is isEnabledFor(), and the results of that are cached 
so it only calls getEffectiveLevel() (which is the thing accessing the 
attribute) once.

Note that populating the cache is already considerably more expensive than the 
previous path (it requires handling an exception and acquiring a lock), but 
it's still worth it because the cost is typically amortised across many log 
calls. The addition of an extra property lookup in this path is not going to be 
noticeable.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37857>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to