Webdev: the times, they are a changin'
amcnabb at mcnabbs.org
Thu Apr 19 12:04:23 MDT 2012
On Thu, Apr 19, 2012 at 11:27:17AM -0600, Levi Pearson wrote:
> On Thu, Apr 19, 2012 at 7:13 AM, Dave Smith <dave at thesmithfam.org> wrote:
> > That is my biggest beef with Python: You simply cannot auto-indent. And before you say, "Well, the language naturally indents, so there's no need", may I offer this preemptive retort:
> The meaning of 'auto-indent' is a bit different in Python than it is
> with languages that do not consider the amount of indentation to be
> lexically significant. When your language has non-whitespace block
> delimiters, then whitespace can be fiddled with trivially without
> changing the program meaning. You can indent and un-indent without
> looking at the context, so this is what most text editors do. The
> fact that this fails with Python does not mean that Python indentation
> can't be easily understood and refactored by a program.
Indeed, auto-indent in Python makes about as much sense as
> > If I have an existing block of code that I want to wrap in an "if" statement, I have to manually indent the whole block (thank goodness for Vim's Ctrl+v and Shift+i). In C++, I would simply wrap the block in an "if" with its curly braces, and then auto-indent using Vim's "%" curly brace matching command and the "=" auto-indent command.
> > If I attempt the same with Python, I'm likely to change the flow control in the block. Blarg!
> I'm sorry that vim sucks at editing Python code. This is not Python's
> fault, though.
Vim really doesn't suck for Python. I use shift-v and > to indent a
block and shift-v and < to dedent. How is this any harder than going
and adding the close brace? The hard part is figuring out where your
block ends, and you have to do that in any editor.
PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868
More information about the PLUG