From 136ea7638073d2de0418ac71f09f723d830d6a40 Mon Sep 17 00:00:00 2001 From: itamarst <> Date: Thu, 15 Oct 2020 13:45:15 +0000 Subject: [PATCH] [Imported from Trac: page Python3, version 39] --- Python3.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Python3.md b/Python3.md index 366530e..a9cace1 100644 --- a/Python3.md +++ b/Python3.md @@ -141,4 +141,15 @@ One of them is the `bytes` objects: ## Don't leak Future objects -Leaking Future objects (newints, new dicts, new bytes) in module API can break existing code on Python 2. So need to be careful not to do that. For that reason int isn't in the suggested `from builtins import ...` list above. \ No newline at end of file +Leaking Future objects (newints, new dicts, new bytes) in module API can break existing code on Python 2. So need to be careful not to do that. For that reason int isn't in the suggested `from builtins import ...` list above. + +## Dealing with utility modules + +Often you will have some utility module with lots of random code, some of which doesn't work on Python 3, or which even involves imports of non-Python-3-compatbile code (Nevow, in this case). + +Options: + +1. Create new `util_py3.py` module, move just the things you need, have `util.py` import code from there. +2. Add conditional imports/declarations to `util.py` so it imports on Python 3 and at least some of the code can be made to work. + +Originally we went with first approach, but plausibly second approach is better. \ No newline at end of file