[libvirt] [PATCH] python: simplify complicated conditional assignment

Claudio Bley cbley at av-test.de
Wed Aug 21 14:05:21 UTC 2013


Signed-off-by: Claudio Bley <cbley at av-test.de>
---
Just noticed this while reading the generated .py files.

Might save a few cycles eventually...

 python/generator.py |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/python/generator.py b/python/generator.py
index 427cebc..10390c3 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -1455,8 +1455,7 @@ def buildWrappers(module):
                 elif classname in [ "virDomainSnapshot" ]:
                     classes.write("        self._dom = dom\n")
                     classes.write("        self._conn = dom.connect()\n")
-                classes.write("        if _obj != None:self._o = _obj;return\n")
-                classes.write("        self._o = None\n\n")
+                classes.write("        self._o = _obj\n\n")
             destruct=None
             if classes_destructors.has_key(classname):
                 classes.write("    def __del__(self):\n")
-- 
1.7.9.5




More information about the libvir-list mailing list