[openstack-dev] Use of local()

Monty Taylor mordred at inaugust.com
Thu Feb 7 19:43:11 UTC 2013



On 02/07/2013 01:33 PM, Andrew Laski wrote:
> On 02/07/13 at 10:23am, Nachi Ueno wrote:
>> Hi folks
>>
>> I wanna ask the opinion of use of local()
>> This function is mainly used for logging because of no need to specify
>> actual parameters.
>>
>> However, the variable ,which code checker says it is not used, is used
>> by local() sometimes.
>> so I prefer not to use local() .
>> I also believe to specify used parameter improves readability of the
>> code.
> 
> I agree.  I prefer the explicitness of passing variables to string
> interpolation, and my style checker also picks up the variables which it
> thinks are not used.
> 
> I would support a check in hacking.py for this in Nova but personally
> don't think reviewers should spend time worrying about it.  Which means
> that I think it's an uphill battle for projects without something like
> hacking.py.

If we get locals() use removed, we should be pretty close to being able
to turn on pyflakes. At that point, we should be able to let it handle it.

Monty



More information about the OpenStack-dev mailing list