Python questions from C/Perl/Java programmer

Samuel Scarano srs25 at cornell.edu
Tue Jul 25 10:39:06 EDT 2000


> > e.g. In the following example, If you want to added a new 'if' between
> > line 1 and 2, you have to add TAB from Line 2 to 199,
> > it's difficult to make sure you don't make mistake. (The case may be
> 
> You ARE joking, right?  If you hadn't mentioned vi, I would still
> be doubtful, but, *with* vi, what can POSSIBLY be easier than
>     :2,199s/^/<tab>/
> ?!

I'll tell you what's easier: 
197>

(although in reality, you would know the line number, so you would say
something like 

ma^f^f^f^f>'a

I'm not posting this just to brag/advtertize/proselytize WRT vi or vim;
rather, I think it's important to point out that good programmer's editors
make it easy to control tabs over many lines, so ensuring that python code
is parsed correctly is really not a problem.

In fact, you have the converse assurance -- that the code you see (in
particular, code written by many people over many years) will be indented
correctly. Wish I could say the same for the C code where I work....

On the other hand, I will say this: the squiggly braces around blocks in
C-influenced programming languages are nice for quickly locating the
opposite boundary of a block (esp. functions). There have been times when I
wanted to skip to the end of along function and wished I could just use
vim's "%" command.

-- 
Samuel R. Scarano                        "Due to circumstances beyond my
Cornell University undergraduate         control, I am master of my fate
<srs25 at cornell.edu>                      and captain of my soul."
http://people.cornell.edu/pages/srs25/             -- Ashleigh Brilliant



More information about the Python-list mailing list