From 95985716d2fcb9aa223dc615320e8126a4d3649d Mon Sep 17 00:00:00 2001 From: jaraco <> Date: Mon, 15 Feb 2021 17:37:37 +0000 Subject: [PATCH] Need also to remove 'from builtins import str' [Imported from Trac: page Python3, version 74] --- Python3.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Python3.md b/Python3.md index 1ada217..88fce5f 100644 --- a/Python3.md +++ b/Python3.md @@ -106,6 +106,7 @@ Delete this bit: ```#!python from future import standard_library standard_library.install_aliases() +from builtins import str ``` And replace the `from builtins import *` variant, if any, with: @@ -121,7 +122,7 @@ This adds builtins that match Python 3's semantics. The `#noqa: F401` keeps flak Consider using this sed command to execute the above: ``` -$ sed -ie '/from future import standard_library/d;/standard_library.install_aliases()/d;s/from builtins import \*/from future.utils import PY2\\nif PY2:\\n from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401/' path/to/file.py +$ sed -ie '/from future import standard_library/d;/standard_library.install_aliases()/d;/from builtins import str/d;s/from builtins import \*/from future.utils import PY2\\nif PY2:\\n from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401/' src/allmydata/test/test_runner.py ``` **Fourth**, manually review the code. Futureize is nice, but it very definitely doesn't catch everything, or it makes wrong decisions.