-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-128688 Introduce qualname in extra parameters providing qualified name including classname. #128634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
This requires a NEWS entry though. This is a new feature so we need a blurb and a What's New entry (in Doc/whatsnew/3.14.rst). This also requires the logging documentation to be updated. |
Maybe update the docstring with this change? - Find the stack frame of the caller so that we can note the source
- file name, line number and function name.
+ Find the stack frame of the caller so that we can note the source
+ file name, line number and function name (qualified name if
+ `self.use_qualname` is ``True`` , otherwise simple name). |
Well, it's not enough to update the docstring - the documentation should be updated (lots of people using the package wouldn't be looking at the source code), and also unit tests are needed. |
Also, I noticed that the title of this PR, and the discussion on DPO ( To my mind, the process of proposing a new feature by a non-maintainer should be:
Although the qualified name isn't provided (I guess as it wasn't available in Python < 3.11), it's not strictly necessary, as the line number and pathname in log output can locate the logging location exactly. It might be seen as more friendly, but then people have to worry about what happens when their code runs on Python < 3.11. Have you thought these kinds of things through? If so, what have you concluded? |
Sorry for not answering, was too busy. The line unfortunately is not enough and the function name too as we have sometimes big files with different classes implementing same interface so all the function names are the same. Regarding the per instance vs per class setting is a good point as well. Everything will be addressed in the near time. Thank you for your comments. |
This sounds like a problem with your codebase rather than a more general problem, and the standard library is for general improvements rather than things which only benefit a narrow category of use cases. Anyway, I still don't see why a combination of pathname and line number don't pinpoint the code location exactly in your situation. |
It does pinpoint to the place in the code. The proposed feature is opt-in, so only ones who need it will turn it on. |
The bar for adding features to the stdlib is high, even for opt-in features. It's got to be useful for a fair number of people and maintain backwards compatibility. |
What is the best way to understand whether many people enough find this useful? |
Open a thread on https://discuss.python.org/c/ideas/6. If there's enough support, we can accept it. Otherwise, if there's no consensus, it's generally something that shouldn't be part of the standard library. My 2c: adding the qualname in addition to the filename + lineno is sometimes easier because you can CTRL+F the qualname. I personally don't need it though. |
Uh oh!
There was an error while loading. Please reload this page.