[igt-dev] [PATCH i-g-t v2 06/13] scripts/test_list.py: close config file before start processing

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Thu Jul 13 05:47:15 UTC 2023


On Wed, 12 Jul 2023 20:38:59 +0200
Kamil Konieczny <kamil.konieczny at linux.intel.com> wrote:

> Hi Mauro,
> 
> On 2023-07-12 at 15:58:47 +0200, Mauro Carvalho Chehab wrote:
> > From: Mauro Carvalho Chehab <mchehab at kernel.org>
> > 
> > Reduce the identation level of the code which parses the config
> > file, as this can be done after closing the file.  
> ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Where it is? Maybe should be dropped?
> 
> > 
> > This is a preparation for the next patch that will offer a different
> > way to pass the configuration.  
> 
> Could you change description? Now it is a little confusing,
> you only change indentation but it state:
> 
> v2 06/13 scripts/test_list.py: close config file before start processing
> ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Maybe something like: change indentation of code

I opted to describe the functional change, and not the physical one.

This is something I don't like on python: changing indentation actuall
changes the code itself, as it doesn't have explicit block markups like
C's { } or Pascal's begin ... end. 

What was happening before was equivalent to this (in C code format):

	fp = fopen(...)
	if (!fp) exit();	// implicit, as this is python normal behavior
	{
		fread()
		// do a lot of things (unrelated to fp itself)
	}
	fclose(fp)

After the change, the code is it now:

	fp = fopen(...)
	if (!fp) exit();
	fread()
	fclose(fp)
	// do a lot of things
	
Yeah, as a side effect, we have one less level of indentation, which is
indeed a good thing.

Regards,
Mauro


More information about the igt-dev mailing list