From: Paolo Bonzini <pbonzini@redhat.com>
To: Martin Cerveny <M.Cerveny@computer.org>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH 2/2] scripts: qom-tree: add support of path as argument
Date: Thu, 14 May 2015 12:00:01 +0200 [thread overview]
Message-ID: <55547221.4030109@redhat.com> (raw)
In-Reply-To: <1431519294-8873-3-git-send-email-M.Cerveny@computer.org>
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
WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Martin Cerveny <M.Cerveny@computer.org>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] scripts: qom-tree: add support of path as argument
Date: Thu, 14 May 2015 12:00:01 +0200 [thread overview]
Message-ID: <55547221.4030109@redhat.com> (raw)
In-Reply-To: <1431519294-8873-3-git-send-email-M.Cerveny@computer.org>
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
next prev parent reply other threads:[~2015-05-14 10:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 12:14 [Qemu-trivial] [PATCH 0/2] Some fixes to qom scripts Martin Cerveny
2015-05-13 12:14 ` [Qemu-devel] " Martin Cerveny
2015-05-13 12:14 ` [Qemu-trivial] [PATCH 1/2] scripts: qom-*: add network syntax Martin Cerveny
2015-05-13 12:14 ` [Qemu-devel] " Martin Cerveny
2015-05-19 12:51 ` [Qemu-trivial] " Andreas Färber
2015-05-19 12:51 ` Andreas Färber
2015-05-19 13:56 ` [Qemu-trivial] " Eric Blake
2015-05-19 13:56 ` Eric Blake
2015-05-19 14:12 ` [Qemu-trivial] " Martin Cerveny
2015-05-19 14:12 ` Martin Cerveny
2015-05-19 14:17 ` [Qemu-trivial] " Eric Blake
2015-05-19 14:17 ` Eric Blake
2015-05-19 14:23 ` [Qemu-trivial] " Andreas Färber
2015-05-19 14:23 ` Andreas Färber
2015-05-19 14:16 ` [Qemu-trivial] " Daniel P. Berrange
2015-05-19 14:16 ` Daniel P. Berrange
2015-05-13 12:14 ` [Qemu-trivial] [PATCH 2/2] scripts: qom-tree: add support of path as argument Martin Cerveny
2015-05-13 12:14 ` [Qemu-devel] " Martin Cerveny
2015-05-14 10:00 ` Paolo Bonzini [this message]
2015-05-14 10:00 ` Paolo Bonzini
2015-05-14 11:41 ` [Qemu-trivial] " Martin Cerveny
2015-05-14 11:41 ` [Qemu-devel] " Martin Cerveny
2015-05-14 11:47 ` [Qemu-trivial] " Paolo Bonzini
2015-05-14 11:47 ` [Qemu-devel] " Paolo Bonzini
2015-05-19 12:47 ` [Qemu-trivial] " Andreas Färber
2015-05-19 12:47 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55547221.4030109@redhat.com \
--to=pbonzini@redhat.com \
--cc=M.Cerveny@computer.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.