[openstack-dev] Use of local()

Thierry Carrez thierry at openstack.org
Fri Feb 8 10:16:02 UTC 2013


Jay Pipes wrote:
> On 02/07/2013 09:58 PM, Sean Dague wrote:
>> On 02/07/2013 06:04 PM, Nachi Ueno wrote:
>>>> I suspect we should just slowly transition as people touch code.
>>>
>>> I agree. The reason why I asked this is for reviewing.
>>> so I'll comment not to use local() in review.
>>
>> If we have rough concensus start with updating HACKING in the relevant 
>> projects. Then I suggest a grind through replacing the code. Once it's 
>> out we can enforce it in hacking.py (comming soon to a project near you, 
>> and not just in nova and tempest).
> 
> Go for it. Jason's suggestion for allowing LOG.debug() et al messages to
> allow kwargs would make things much more readable than supplying huge
> manually-coded dicts.

If consensus is that Jason's suggestion is the right mix between
readability and length, maybe we should wait for oslo-logging to support
kwargs, rather than start fixing locals() now and be left with a mix of
various solutions (% {}, % dict(), kwargs and locals()).

I'd prefer to have one true recommended solution to replace the
confusing one, rather than just say the confusing one is now officially
bad practice, and let people go wild with various solutions.

-- 
Thierry Carrez (ttx)
Release Manager, OpenStack



More information about the OpenStack-dev mailing list