Compare source code
nagle at animats.com
Fri Nov 5 19:35:31 CET 2010
On 11/5/2010 3:41 AM, Steven D'Aprano wrote:
> On Thu, 04 Nov 2010 20:17:35 +0000, Seebs wrote:
>>> * I /do/ have a significant problem with cutting and pasting code in
>>> Python. In most languages, I can haul a chunk of code about, hit
>>> C-M-q, and Emacs magically indents the result properly. This is,
>>> unfortunately, impossible with Python. It has caused me real bugs,
>>> and I have to be extra careful to fix the indentation up.
>> That was the thing which bit me the worst. I had a fairly large block
>> of code in a first-pass ugly program. I wanted to start refactoring it,
>> so I moved a big hunk of code into a method (with plans to further
>> refactor). It took about fifteen minutes to redo the logic.
> Well there's your problem -- you are relying on tools that operate by
Not magic, just code understanding.
INTERLISP's editor allowed the user to select a block of
LISP code and make it into a function. The selected block
would be analyzed to determine which local variables it referenced,
and a new function would be created with those parameters. The
block of code at the original point would then be replaced by
a call to the function.
Today's editors are too dumb to do that right. They're text
editors with the illusion of knowing something about the language,
not language editors which also format text.
More information about the Python-list