All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Michael Tokarev <mjt@tls.msk.ru>, Amos Kong <akong@redhat.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH] qapi: cleanup redundant variable
Date: Mon, 03 Feb 2014 11:23:09 -0700	[thread overview]
Message-ID: <52EFDE8D.4030701@redhat.com> (raw)
In-Reply-To: <52ECC317.5060004@msgid.tls.msk.ru>

[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]

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 <akong@redhat.com>
>> ---
>>  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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Eric Blake <eblake@redhat.com>
To: Michael Tokarev <mjt@tls.msk.ru>, Amos Kong <akong@redhat.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] qapi: cleanup redundant variable
Date: Mon, 03 Feb 2014 11:23:09 -0700	[thread overview]
Message-ID: <52EFDE8D.4030701@redhat.com> (raw)
In-Reply-To: <52ECC317.5060004@msgid.tls.msk.ru>

[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]

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 <akong@redhat.com>
>> ---
>>  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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-02-03 18:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23  8:54 [Qemu-trivial] [PATCH] qapi: cleanup redundant variable Amos Kong
2014-01-23  8:54 ` [Qemu-devel] " Amos Kong
2014-02-01  9:49 ` [Qemu-trivial] " Michael Tokarev
2014-02-01  9:49   ` [Qemu-devel] " Michael Tokarev
2014-02-03 18:23   ` Eric Blake [this message]
2014-02-03 18:23     ` Eric Blake

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=52EFDE8D.4030701@redhat.com \
    --to=eblake@redhat.com \
    --cc=akong@redhat.com \
    --cc=mjt@tls.msk.ru \
    --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.