AW: [PATCH 1/1] misc: tools: fix mkimage.py script type processing

Andre.Nahrwold at dlr.de Andre.Nahrwold at dlr.de
Wed Feb 17 07:34:45 UTC 2021


Hi Chris,

as far as my understanding of python goes this does not make any difference.
Strings are essentially arrays in python which would make the parenthesis obsolete.

When this condition should catch another type in the future it would be good practice to do something like this:

If options.type in ['script', '<other-type>']:

Even though the following would be functional the same but obviously much less readable and logical:

If options.type in 'script<other-type>':

Best regards
André

-----Ursprüngliche Nachricht-----
Von: Chris Johns <chrisj at rtems.org> 
Gesendet: Dienstag, 16. Februar 2021 21:29
An: Sommer, Jan <Jan.Sommer at dlr.de>; devel at rtems.org
Cc: Nahrwold, Andre <Andre.Nahrwold at dlr.de>
Betreff: Re: [PATCH 1/1] misc: tools: fix mkimage.py script type processing

On 12/2/21 3:23 am, Jan Sommer wrote:
> From: Andre Nahrwold <andre.nahrwold at dlr.de>
> 
> ---
>  misc/tools/mkimage.py | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/misc/tools/mkimage.py b/misc/tools/mkimage.py index 
> fd75f0a..111e224 100755
> --- a/misc/tools/mkimage.py
> +++ b/misc/tools/mkimage.py
> @@ -121,6 +121,16 @@ outputfile.seek(struct.size);
>  
>  inputcrc = 0;
>  
> +if options.type in 'script':

I saw this and thought it might be wrong and now I think it is. Should this line be:

 > +if options.type in ['script']:

?

Chris


More information about the devel mailing list