Manage indentation with textwrap
Opened this issue · 9 comments
Since python2 will not be maintained soon, according to DRY, may be it would be a good idea to replace (make aliases) dill indentation methods with ones from core library?
For example, dill.source.indent with textwrap.indent, dill.source.outdent with textwrap.dedent.
If python2 support is critical, then dill methods could be refactored, using python2.7 textwrap.
If the idea is acceptable in general, I could provide a patch.
Looks unnecessary.
Kicking this down the road a bit. Support for 2.7 will end soon, so that's probably the appropriate time to deal with this.
dill-0.3.6 will not support 2.7, support will be dropped imminently
2.7 is no longer supported
There's a difference in the intent:
textwrap.dedent(text)
and textwrap.indent(text, prefix, predicate=None)
are intended to shift text, while dill.source.indent(code, spaces=4)
and dill.source(code, spaces=None, all=True)
is intended to (identify and) shift blocks of code (e.g. inside a def
).
I think one would need a bunch of existing logic with only a little replaced with dedent
. While on the other hand, dill.source.indent
may be able to build a complex predicate or predicates that can replace most of its code.
Will need more investigation...
I'm going to punt this (again) to the next milestone, and come back to it after the pending release.