qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [PATCH 2/2] scripts: qom-tree: add support of path as


From: Martin Cerveny
Subject: Re: [Qemu-trivial] [PATCH 2/2] scripts: qom-tree: add support of path as argument
Date: Thu, 14 May 2015 13:41:23 +0200 (CEST)
User-agent: Alpine 2.00 (GSO 1167 2008-08-23)

Hello.

Ternary/if/else >= python 2.5 (I use the same coding as in 
scripts/qmp/qemu-ga-client).
"import json" >= python 2.6 (scripts/qmp/qmp.py)
"import argparse" >= python 2.7 (scripts/analyze-migration.py, 
scripts/vmstate-static-checker.py)
"import optparse" < python 2.7 (deprecated, scripts/qmp/qemu-ga-client)
....

Of course there is no problem to use traditional syntax.
(My platform (centos5.10) has python2.4, I must also replace json imports:
try:
    import json
except ImportError:
    import simplejson as json
)

Which version of python is officialy minimum supported ?

Thanks for explanation of python status.

M.C>

On Thu, 14 May 2015, Paolo Bonzini wrote:



On 13/05/2015 14:14, Martin Cerveny wrote:
     for item in items:
         if item['type'].startswith('child<'):
-            list_node(path + '/' + item['name'])
+            list_node((path if (path != '/') else '')  + '/' + item['name'])

I'm not sure which Python version introduced if...else.  The more
traditional idiom would be

        path != '/' and path or ''

Can you use it, and move the expression out of the 'for item in items'
loop into a variable?

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]