diff options
author | Dirk Mueller <dirk@dmllr.de> | 2013-05-18 00:18:18 +0200 |
---|---|---|
committer | Dirk Mueller <dirk@dmllr.de> | 2013-06-01 09:57:31 +0200 |
commit | bf68a9592db4c90bc9421ce49c7c0766966d6e7e (patch) | |
tree | 0a02a49d60348af8cb74d9be59c7a961666b7f01 /HACKING.rst | |
parent | 5a510518d9e3097730466cfbf4ff25495c4a0302 (diff) | |
download | nova-bf68a9592db4c90bc9421ce49c7c0766966d6e7e.tar.gz |
Improve Python 3.x compatibility
Mechanical translation of the deprecated
except x,y: construct with except x as y:
The latter works with any Python >= 2.6.
Add Hacking check.
Change-Id: I845829d97d379c1cd9b3a77e7e5786586f263b64
Diffstat (limited to 'HACKING.rst')
-rw-r--r-- | HACKING.rst | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/HACKING.rst b/HACKING.rst index 307d7477c9..b29361a8d1 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -211,6 +211,25 @@ Example:: LOG.error(msg % {"s_id": "1234", "m_key": "imageId"}) +Python 3.x compatibility +------------------------ +Nova code should stay Python 3.x compatible. That means all Python 2.x-only +constructs should be avoided. An example is + + except x,y: + +Use + + except x as y: + +instead. Other Python 3.x compatility issues, like e.g. print operator +can be avoided in new code by using + + from __future__ import print_function + +at the top of your module. + + Creating Unit Tests ------------------- For every new feature, unit tests should be created that both test and |