[Top][All Lists]

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

Re: [Qemu-trivial] [PATCH] qapi: cleanup redundant variable

From: Eric Blake
Subject: Re: [Qemu-trivial] [PATCH] qapi: cleanup redundant variable
Date: Mon, 03 Feb 2014 11:23:09 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 02/01/2014 02:49 AM, Michael Tokarev wrote:
> 23.01.2014 12:54, Amos Kong wrote:
>> No need to re-append an expr list, it's ok to return schema.exprs
>> Signed-off-by: Amos Kong <address@hidden>
>> ---
>>  scripts/qapi.py | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)

>> @@ -185,9 +183,8 @@ def parse_schema(fp):
>>              add_enum('%sKind' % expr['union'])
>>          elif expr.has_key('type'):
>>              add_struct(expr)
>> -        exprs.append(expr)
>> -    return exprs
>> +    return schema.exprs
> I don't really know python.  Does it mean that previously,
> this function returned a copy of schema.exprs, but now it
> returns schema.exprs itself, so a caller can modify it?

My python is also weak (hence my lack of R-b), but yes, I believe you
are correct.  On the other hand, parse_schema is only called up front,
so I don't think callers are modifying the return value anyways, so does
it matter?

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

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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