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

Eric Blake eblake at redhat.com
Wed Aug 21 16:24:16 UTC 2013


On 08/21/2013 08:05 AM, Claudio Bley wrote:
> 
> 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(-)

ACK.

> 
> 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")
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130821/b8ce4eb2/attachment-0001.sig>


More information about the libvir-list mailing list