Python futurize without replacing / with old_div

蹲街弑〆低调 提交于 2020-01-02 00:56:12

问题


I am using futurize --stage2 which aplies a number of source-source transformation to make the code python2 and python3 compatible. One of those fixes is that all divisions a/b are replaced by old_div(a/b), which I would like to avoid (there is too many, and many of them are replaced unnecessarily, such as math.pi/2.. The documentation says that --nofix (or -x) can be used to avoid running a certain fixes, but trying --nofix=fix_divison or --nofix=libfuturize.fixes.fix_divison has no effect with --stage2. Can someone perhaps help how to ignore that particular fixer otherwise?


回答1:


Omit the prefix fix_.

futurize --nofix=division ...

Depending on version you're using, you may need to specify the division_safe:

futurize --nofix=division_safe ...


来源:https://stackoverflow.com/questions/33198049/python-futurize-without-replacing-with-old-div

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!