[Python-ideas] Make Difflib example callable as module __main__
ncoghlan at gmail.com
Wed Feb 22 23:08:08 CET 2012
On Thu, Feb 23, 2012 at 7:40 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> If you run difflib directly, it runs difflib._test. which runs a doctest on
> difflib. Most modules do something similar. Having a real command-line
> interface in the module itself is unusual.
That's largely a historical artifact though - prior to -m direct
execution was a pain, so the only time it really happened was in a
source checkout during development. (plus I don't believe regrtest
always had selective test execution, so run the library directly was a
good way to only run some of the tests).
If there's useful functionality that can be provided via -m, I'm a fan
of moving tests out of the way to make room for it (it's also a good
opportunity to make sure regrtest is covering whatever __main__
I think there's also an open tracker issue suggesting the creation of
a dedicated section in the standard library docs that summarises all
the modules that offer useful -m functionality.
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas