On 8 November 2017 at 11:46, Guido van Rossum <gu...@python.org> wrote: > On Tue, Nov 7, 2017 at 5:35 PM, Nick Coghlan <ncogh...@gmail.com> wrote: >> >> On 8 November 2017 at 10:03, Guido van Rossum <gu...@python.org> wrote: >> > OK, so let's come up with a set of heuristics that does the right thing >> > for >> > those cases specifically. I'd say whenever you're executing code from a >> > zipfile or some such it's not considered your own code (by default). >> >> My current preferred heuristic is just to add a new default filter to the >> list: >> >> once::DeprecationWarning:__main__ >> >> Which says to warn specifically for the __main__ module, and continue >> ignoring everything else. > > OK, that sounds great. > >> That way ad hoc scripts and the REPL will get warnings by default, >> while zipapps and packages can avoid warnings by keeping their >> __main__.py simple, and importing a CLI helper function from another >> module. Entry point wrapper scripts will implicitly have the same >> effect for installed packages. > > That's fine. > >> If folks want to get warnings for other modules as well, then they can >> either pass "-Wd" to get warnings for everything, or else enable them >> selectively using the default main module filter as an example. > > Assuming that's how it already works, we're done here. :-)
Cool :) RFE filed here for that specific change to the default filter set: https://bugs.python.org/issue31975 Cheers, Nick. P.S. If anyone wants to follow up on some of the other more esoteric ideas we've discussed in the past few days, they can be separate RFEs. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com