← Back to team overview

launchpad-dev team mailing list archive

Re: New coding standard for formatting imports

 

On Thu, Aug 19, 2010 at 9:31 AM, Jonathan Lange <jml@xxxxxxxxxxxxx> wrote:
> On Thu, Aug 19, 2010 at 2:26 PM, Jeroen Vermeulen <jtv@xxxxxxxxxxxxx> wrote:
>> On 2010-08-19 20:10, Jonathan Lange wrote:
>>
>>>> But does that have to be a joke?  Couldn't we generate imports (well,
>>>> those
>>>> from other Launchpad modules) automatically during branch build?
>>>
>>> ...
>>>
>>> I would much rather use editor tools than a preprocessor. Once we
>>> introduce a mandatory preprocessing stage, we are no longer writing
>>> Python code. Editor tools provide much the same convenience, but leave
>>> us still writing standard Python.
>>
> ...
>> The part I haven't thought about at all yet is how to avoid this being an
>> extra step, or a noticeable delay, for the developer.  But at any rate we
>> may find a "make" before testing preferable over editing imports ourselves.
>>  I for one dislike that jump to the top of the file and back.
>>
>
> Easily avoided with a scriptable editor. IIRC, Edwin demonstrated a
> vim script for this at the Epic.

Another Vim tip for jumping around: ctrl-o will take you back to where
you were, so adding an import by hand is:

    1G -- go to the top of the file
    [misc screwing around to get the import added]
    ctrl-o -- go back to where you were

Bonus tip: ctrl-i will go forward to where you were before so
ctrl-i/ctrl-o travel forward/back in a sequence of file positions.
-- 
Benji York



Follow ups

References