I'm attempting to convert a library from Py 2.7.x to Py 3.7.x using 2to3 on Win10. Following reference from here.
I've seen that to convert some parts of Python you need to explicitly add Fixers, specifically:
idioms
This optional fixer performs several transformations that make
Python code more idiomatic. Type comparisons like type(x) is SomeClass
and type(x) == SomeClass are converted to isinstance(x, SomeClass).
while 1 becomes while True. This fixer also tries to make use of
sorted() in appropriate places. For example, this block
L = list(some_iterable) L.sort() is changed to
L = sorted(some_iterable)
So I add it to my commandline:
2to3 --output-dir=C:mypy3module -f all -f buffer -f idioms -f set_literal -f ws_comma -W -n C:mypy2module
2to3 will generate the correct files in the C:mypy3module folder but list.sort() has not been resolved to sorted(list)
What am I missing here?
question from:
https://stackoverflow.com/questions/65646983/2to3-not-resolving-sort-to-sorted 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…