qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Lukáš Doktor" <ldoktor@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	apahim@redhat.com, qemu-devel@nongnu.org, famz@redhat.com,
	armbru@redhat.com, mreitz@redhat.com, ehabkost@redhat.com
Subject: Re: [Qemu-devel] [PATCH 06/11] qmp.py: Couple of pylint/style fixes
Date: Tue, 25 Jul 2017 08:13:00 +0200	[thread overview]
Message-ID: <32f17245-d2ec-6fb2-10b3-3f97e05a66b5@redhat.com> (raw)
In-Reply-To: <2cb14375-2300-83d5-a689-db5aadf2cf20@amsat.org>

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

Dne 25.7.2017 v 08:04 Philippe Mathieu-Daudé napsal(a):
> Hi Lukáš,
> 
> On 07/24/2017 09:36 AM, Lukáš Doktor wrote:
>> Dne 22.7.2017 v 03:30 Philippe Mathieu-Daudé napsal(a):
>>> Hi Lukáš,
>>>
>>> Since comment/indent fixes and code changes are not related I'd rather see this split in at least 2 patches.
>>>
>> Hello Philippe, thank you for the review, I'm wondering what code changes you have in mind? This is commit should not bring any code changes, just code reorganization (like including the self.* attributes on top of the file)
>>
>>> On 07/20/2017 01:28 PM, Lukáš Doktor wrote:
>>>> No actual code changes, just a few pylint/style fixes and docstring
>>>> clarifications.
>>>>
>>>> Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
>>>> ---
>>>>    scripts/qmp/qmp.py | 37 ++++++++++++++++++++++++-------------
>>>>    1 file changed, 24 insertions(+), 13 deletions(-)
>>>>
>>>> diff --git a/scripts/qmp/qmp.py b/scripts/qmp/qmp.py
> [...]
>>>>        def __init__(self, address, server=False, debug=False):
>>>>            """
>>>>            Create a QEMUMonitorProtocol class.
>>>> @@ -42,6 +53,7 @@ class QEMUMonitorProtocol:
>>>>            self.__address = address
>>>>            self._debug = debug
>>>>            self.__sock = self.__get_sock()
>>>> +        self.__sockfile = None
> 
> I was thinking about this line which is new. Now the declaration and initialization are done in __init__() while before it was only declared/initialized in connect() or accept().
> 
> I'm not expert of python interpreter/jit internals but expect the generated code to be slightly different, even if achieving the same.
> 
> not a bit deal, just about wording ;)
> 
Well the difference is that before `connect` you get `AttributeError` when looking for `self.__sockfile` while with this patch you'll get `None`. In this code nobody queries for `self.__sockfile` before the `connect` so it should not change the behavior of this code so I consider that as a `style` fix as it's ugly to extend attributes later in code (with some exceptions like Namespace-objects..). Anyway if you insist I can split those patches.

Lukáš

>>>>            if server:
>>>>                self.__sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
>>>>                self.__sock.bind(self.__address)



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 502 bytes --]

  reply	other threads:[~2017-07-25  6:13 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20 16:28 [Qemu-devel] [PATCH 00/11] qemu.py: Pylint/style fixes Lukáš Doktor
2017-07-20 16:28 ` [Qemu-devel] [PATCH 01/11] " Lukáš Doktor
2017-07-21  5:28   ` Philipp Hahn
2017-07-20 16:28 ` [Qemu-devel] [PATCH 02/11] qemu.py: Avoid dangerous arguments Lukáš Doktor
2017-07-20 18:19   ` Eduardo Habkost
2017-07-22  1:22   ` Philippe Mathieu-Daudé
2017-07-20 16:28 ` [Qemu-devel] [PATCH 03/11] qemu.py: Use iteritems rather than keys() Lukáš Doktor
2017-07-20 18:19   ` Eduardo Habkost
2017-07-22  1:22   ` Philippe Mathieu-Daudé
2017-07-20 16:28 ` [Qemu-devel] [PATCH 04/11] qemu.py: Simplify QMP key-conversion Lukáš Doktor
2017-07-20 18:20   ` Eduardo Habkost
2017-07-20 16:28 ` [Qemu-devel] [PATCH 05/11] qemu.py: Use custom exceptions rather than Exception Lukáš Doktor
2017-07-20 18:27   ` Eduardo Habkost
2017-07-21  6:37     ` Lukáš Doktor
2017-07-21 18:42       ` Eduardo Habkost
2017-07-24 12:13         ` Lukáš Doktor
2017-07-24 15:32           ` Eduardo Habkost
2017-07-25  5:34             ` Lukáš Doktor
2017-07-20 16:28 ` [Qemu-devel] [PATCH 06/11] qmp.py: Couple of pylint/style fixes Lukáš Doktor
2017-07-22  1:30   ` Philippe Mathieu-Daudé
2017-07-24 12:36     ` Lukáš Doktor
2017-07-25  6:04       ` Philippe Mathieu-Daudé
2017-07-25  6:13         ` Lukáš Doktor [this message]
2017-07-25  6:20           ` Philippe Mathieu-Daudé
2017-07-20 16:28 ` [Qemu-devel] [PATCH 07/11] qmp.py: Use object-based class for QEMUMonitorProtocol Lukáš Doktor
2017-07-20 18:35   ` Eduardo Habkost
2017-07-21  6:50     ` Lukáš Doktor
2017-07-21 18:43       ` Eduardo Habkost
2017-07-20 16:28 ` [Qemu-devel] [PATCH 08/11] qmp.py: Avoid "has_key" usage Lukáš Doktor
2017-07-20 18:35   ` Eduardo Habkost
2017-07-22  1:31   ` Philippe Mathieu-Daudé
2017-07-20 16:28 ` [Qemu-devel] [PATCH 09/11] qmp.py: Avoid overriding a builtin object Lukáš Doktor
2017-07-20 18:38   ` Eduardo Habkost
2017-07-21  6:53     ` Lukáš Doktor
2017-07-21 18:46       ` Eduardo Habkost
2017-07-24 12:41         ` Lukáš Doktor
2017-07-20 16:28 ` [Qemu-devel] [PATCH 10/11] qtest.py: Few pylint/style fixes Lukáš Doktor
2017-07-20 18:42   ` Eduardo Habkost
2017-07-21  6:57     ` Lukáš Doktor
2017-07-21 18:56       ` Eduardo Habkost
2017-07-24 12:42         ` Lukáš Doktor
2017-07-20 16:28 ` [Qemu-devel] [PATCH 11/11] qtest.py: Avoid using mutable list as default argument Lukáš Doktor
2017-07-20 18:44   ` Eduardo Habkost
2017-07-21  6:58     ` Lukáš Doktor

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=32f17245-d2ec-6fb2-10b3-3f97e05a66b5@redhat.com \
    --to=ldoktor@redhat.com \
    --cc=apahim@redhat.com \
    --cc=armbru@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=famz@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).