Re: [Qemu-devel] [PATCH v4 1/5] iotests: add qmp recursive sorting function

2018-12-19 Thread John Snow
On 12/19/18 2:19 PM, Eric Blake wrote: > On 12/19/18 12:57 PM, John Snow wrote: >> >> >> On 12/19/18 1:52 PM, Eric Blake wrote: >>> On 12/18/18 7:52 PM, John Snow wrote: Python before 3.6 does not sort kwargs by default. If we want to print out pretty-printed QMP objects while

Re: [Qemu-devel] [PATCH v4 1/5] iotests: add qmp recursive sorting function

2018-12-19 Thread Eric Blake
On 12/19/18 12:57 PM, John Snow wrote: On 12/19/18 1:52 PM, Eric Blake wrote: On 12/18/18 7:52 PM, John Snow wrote: Python before 3.6 does not sort kwargs by default. If we want to print out pretty-printed QMP objects while preserving the "exec" > "arguments" ordering, we need a custom sort.

Re: [Qemu-devel] [PATCH v4 1/5] iotests: add qmp recursive sorting function

2018-12-19 Thread John Snow
On 12/19/18 1:52 PM, Eric Blake wrote: > On 12/18/18 7:52 PM, John Snow wrote: >> Python before 3.6 does not sort kwargs by default. >> If we want to print out pretty-printed QMP objects while >> preserving the "exec" > "arguments" ordering, we need a custom sort. > > Naive question - why do

Re: [Qemu-devel] [PATCH v4 1/5] iotests: add qmp recursive sorting function

2018-12-19 Thread Eric Blake
On 12/18/18 7:52 PM, John Snow wrote: Python before 3.6 does not sort kwargs by default. If we want to print out pretty-printed QMP objects while preserving the "exec" > "arguments" ordering, we need a custom sort. Naive question - why do we need the sorting? Is it so that the output is

Re: [Qemu-devel] [PATCH v4 1/5] iotests: add qmp recursive sorting function

2018-12-19 Thread Eric Blake
On 12/19/18 11:55 AM, John Snow wrote: +def ordered_kwargs(kwargs): +# kwargs prior to 3.6 are not ordered, so: +od = OrderedDict() +for k in sorted(kwargs.keys()): you can use for k, v in sorted(kwargs.items()): and use then v instead of kwargs[k] I don't need to sort the

Re: [Qemu-devel] [PATCH v4 1/5] iotests: add qmp recursive sorting function

2018-12-19 Thread John Snow
On 12/19/18 5:20 AM, Vladimir Sementsov-Ogievskiy wrote: > 19.12.2018 4:52, John Snow wrote: >> Python before 3.6 does not sort kwargs by default. >> If we want to print out pretty-printed QMP objects while >> preserving the "exec" > "arguments" ordering, we need a custom sort. >> >> We can

Re: [Qemu-devel] [PATCH v4 1/5] iotests: add qmp recursive sorting function

2018-12-19 Thread Vladimir Sementsov-Ogievskiy
19.12.2018 4:52, John Snow wrote: > Python before 3.6 does not sort kwargs by default. > If we want to print out pretty-printed QMP objects while > preserving the "exec" > "arguments" ordering, we need a custom sort. > > We can accomplish this by sorting **kwargs into an OrderedDict, > which does

[Qemu-devel] [PATCH v4 1/5] iotests: add qmp recursive sorting function

2018-12-18 Thread John Snow
Python before 3.6 does not sort kwargs by default. If we want to print out pretty-printed QMP objects while preserving the "exec" > "arguments" ordering, we need a custom sort. We can accomplish this by sorting **kwargs into an OrderedDict, which does preserve addition order. ---