Re: [PATCH v2 09/38] qapi/common.py: Add indent manager

2020-09-25 Thread John Snow
On 9/25/20 7:55 AM, Markus Armbruster wrote: John Snow writes: On 9/23/20 10:55 AM, Cleber Rosa wrote: Do you have a use case for returning the level? If not, I'd go without it, and add a "level" property instead, as it'd serve more cases. __int__ is doing that lifting. I can remove the re

Re: [PATCH v2 09/38] qapi/common.py: Add indent manager

2020-09-25 Thread John Snow
On 9/25/20 7:51 AM, Markus Armbruster wrote: John Snow writes: On 9/22/20 6:22 PM, Eduardo Habkost wrote: On Tue, Sep 22, 2020 at 05:00:32PM -0400, John Snow wrote: Code style tools really dislike the use of global keywords, because it generally involves re-binding the name at runtime which

Re: [PATCH v2 09/38] qapi/common.py: Add indent manager

2020-09-25 Thread Markus Armbruster
Eduardo Habkost writes: > On Fri, Sep 25, 2020 at 01:51:54PM +0200, Markus Armbruster wrote: >> John Snow writes: >> > On 9/22/20 6:22 PM, Eduardo Habkost wrote: > [...] >> > Yeah, there's only one user right now, so ... I just kinda wanted to >> > get rid of the global usage. Maybe if we make t

Re: [PATCH v2 09/38] qapi/common.py: Add indent manager

2020-09-25 Thread Eduardo Habkost
On Fri, Sep 25, 2020 at 01:51:54PM +0200, Markus Armbruster wrote: > John Snow writes: > > On 9/22/20 6:22 PM, Eduardo Habkost wrote: [...] > > Yeah, there's only one user right now, so ... I just kinda wanted to > > get rid of the global usage. Maybe if we make the code generator > > fancier we'l

Re: [PATCH v2 09/38] qapi/common.py: Add indent manager

2020-09-25 Thread Markus Armbruster
John Snow writes: > On 9/23/20 10:55 AM, Cleber Rosa wrote: >> Do you have a use case for returning the level? If not, I'd go >> without it, and add a "level" property instead, as it'd serve more >> cases. > > __int__ is doing that lifting. I can remove the return. I like my functions to return

Re: [PATCH v2 09/38] qapi/common.py: Add indent manager

2020-09-25 Thread Markus Armbruster
John Snow writes: > On 9/22/20 6:22 PM, Eduardo Habkost wrote: >> On Tue, Sep 22, 2020 at 05:00:32PM -0400, John Snow wrote: >>> Code style tools really dislike the use of global keywords, because it >>> generally involves re-binding the name at runtime which can have strange >>> effects dependin

Re: [PATCH v2 09/38] qapi/common.py: Add indent manager

2020-09-23 Thread John Snow
On 9/23/20 10:55 AM, Cleber Rosa wrote: Do you have a use case for returning the level? If not, I'd go without it, and add a "level" property instead, as it'd serve more cases. __int__ is doing that lifting. I can remove the return. --js

Re: [PATCH v2 09/38] qapi/common.py: Add indent manager

2020-09-23 Thread John Snow
On 9/22/20 6:22 PM, Eduardo Habkost wrote: On Tue, Sep 22, 2020 at 05:00:32PM -0400, John Snow wrote: Code style tools really dislike the use of global keywords, because it generally involves re-binding the name at runtime which can have strange effects depending on when and how that global name

Re: [PATCH v2 09/38] qapi/common.py: Add indent manager

2020-09-23 Thread Cleber Rosa
On Tue, Sep 22, 2020 at 05:00:32PM -0400, John Snow wrote: > Code style tools really dislike the use of global keywords, because it > generally involves re-binding the name at runtime which can have strange > effects depending on when and how that global name is referenced in > other modules. > >

Re: [PATCH v2 09/38] qapi/common.py: Add indent manager

2020-09-22 Thread Eduardo Habkost
On Tue, Sep 22, 2020 at 05:00:32PM -0400, John Snow wrote: > Code style tools really dislike the use of global keywords, because it > generally involves re-binding the name at runtime which can have strange > effects depending on when and how that global name is referenced in > other modules. > >

[PATCH v2 09/38] qapi/common.py: Add indent manager

2020-09-22 Thread John Snow
Code style tools really dislike the use of global keywords, because it generally involves re-binding the name at runtime which can have strange effects depending on when and how that global name is referenced in other modules. Make a little indent level manager instead. Signed-off-by: John Snow