[New-bugs-announce] [issue21027] difflib new cli interface

Claudiu.Popa report at bugs.python.org
Sat Mar 22 21:44:16 CET 2014


New submission from Claudiu.Popa:

Hello!

The attached patch proposes a new command line interface to difflib module.
Currently, `python -m difflib` does nothing useful, it runs the doc suite for the difflib module.
Right now, there are a couple of modules in the standard lib, which provides
helpful cli interfaces. For instance, inspect for analyzing an object, compileall for compilation of Python files
or json.tool for validating and pretty printing JSON. Also, in Tools/scripts/ there is a small utility called diff.py,
which uses difflib to implement a simple diff like utility, but the following issue proposes its deprecation
and I'll enumerate my reasons for this:

- On Windows, py -3 -m difflib is easier to use. Yes, Tools/Scripts can be added to PATH, so that diff.py can be used there, but we can't do always that. I have at work a couple of machines where I can't modify the PATH due to user limitations. Having `py -3 -m difflib` as a handy diff tool is invaluable on such systems.

- Continuing the same argument as above, you can't always install a proper diff tool, due to same limitations. Having a simple one builtin in the stdlib is more than useful! Also, you can't always use a versioning system, in order to use its diff feature.

- Tools/Scripts/diff.py is not tested at all.

- diff.py was added before the `-m` thingy came, now `-m difflib` is the more natural way and I hope to see even more modules providing it with useful cli interfaces, like compileall or inspect.

Thanks in advance!

----------
components: Library (Lib)
files: difflib_cli.patch
keywords: patch
messages: 214516
nosy: Claudiu.Popa
priority: normal
severity: normal
status: open
title: difflib new cli interface
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file34571/difflib_cli.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21027>
_______________________________________


More information about the New-bugs-announce mailing list