|
| From: | Anthony Liguori |
| Subject: | Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject |
| Date: | Thu, 10 Dec 2009 10:20:47 -0600 |
| User-agent: | Thunderbird 2.0.0.23 (X11/20090825) |
Avi Kivity wrote:
But we have two null conditions to check for, in an extendible dictionary:1. The feature is unknown to qemu 2. The feature is known to qemu, but disabledSo, "if 'field' in result:" tests the former, and "if result['field']:" tests the latter.In your example, a period of None makes no sense, so it would be sufficient toperiod = hpet_info.get('period', 0.100)
By the same token, wouldn't you probably do:
name = hpet_info.get('name', None)
Let me put it another way, I don't think adding null to the json parser
and incorporating it into this command is a good idea at this stage in
the release so if we want to do something like this, we need to defer it
to 0.13.
I agree there are some instances where null could be useful. I think we can get away without it here though.
-- Regards, Anthony Liguori
| [Prev in Thread] | Current Thread | [Next in Thread] |