[bitbake-devel] [PATCH 00/32] Hob related fixes
Oren Leaffer
oren at ephemeron-labs.com
Sat Mar 3 03:50:16 UTC 2012
Shane,
As I understand it, if you need keep track of indices as you go
through a list, then enumerate() is the python way to do it.
http://docs.python.org/library/functions.html#enumerate
So you would have:
for i, item in enumerate(list):
... etc
Best regards,
Oren
On Fri, Mar 2, 2012 at 1:48 AM, Wang, Shane <shane.wang at intel.com> wrote:
> Joshua Lock wrote on 2012-03-01:
>> One thing I did notice whilst reviewing this series is that there's a
>> lot of this anti-pattern in the hob 2 code:
>> for i in range(len(mylist)):
>> rather than:
>> for item in list:
>>
>> Can we make an effort to tidy those up?
> I will check those later. I went through them quickly.
> Some of them are because the code refers to the index i.
>
> Otherwise, we would have the code.
> i = 0
> for item in list:
> XXXXX
> XXX = i
> i += 1
>
> which also looks not perfect. But anyway, I will check all of them later and send another patch for improvement.
> If there is no reference to the index, I will replace with your style.
>
> --
> Shane
>
>>
>> Cheers,
>> Joshua
>
>
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel at lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/bitbake-devel
More information about the bitbake-devel
mailing list