On 11 November 2017 at 02:02, Random832 <random832 at fastmail.com> wrote: > On Tue, Nov 7, 2017, at 07:22, Nick Coghlan wrote: >> My suggestion for that definition is to have the *default* meaning of >> "third party code" be "everything that isn't __main__". > > What is __main__? Or, rather, how do you determine when it is to blame? > For syntax it's easy, but any deprecated function necessarily belongs to > its own module and not to main. Main may have called it, which can be > detected from the stack trace, or it may have used it in some other way > (pass to some builtin or e.g. itertools function that takes a callable > argument, for example). The warnings machinery already defines how this works (look for "stacklevel"). For callbacks defined as Python code, the deprecated call will be attributed to whichever module defined the callback, not the machinery that called the callback. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4