Python vs. Perl, which is better to learn?

Jeff Shannon jeff at ccvcorp.com
Fri May 10 15:08:44 EDT 2002


In article <3CDBE586.A81BA732 at fnal.gov>, David J. Ritchie says...

> I find I write that way in draft form and that it is effective at
> getting my ideas into text form.  Isn't there something to be
> gained by devising a computing language which lets you take
> that approach--rather than putting strictures on you very early
> before you've even understood what it is that you want to
> communicate to the machine?

I find that, even when refactoring "rough" code, most of the 
indentation *structure* stays the same, even when the overall 
indentation level of a particular block changes.  Even a 
braindead code editor will indent/dedent a block.  I can 
think of very few realistic situations these days, where using a 
halfway decent editor to program in is a problem -- we've had 
fullscreen editors for decades now, and even when "lightweight" 
is a concern, something like ed is horribly obsolete.  This looks 
to me like you're complaining that you can't do desktop 
publishing with a manual typewriter...

> If so, then a computer language that lets you move blocks of
> code around easily is an advantage.  With Python, it is clear
> that you need to augment the language with a suitably capable
> editor if you adopt that composition style.  Maybe it's just the
> beginning of the indication that one should be composing--not
> in a text editor at all--but in a design tool that generates the
> text--that's sort of what the popularity of the "visual xxx" things
> are saying...

I don't think this is just a Python issue.  I think that if 
you're reformatting *any* code, and leaving the indentation 
ragged, then you're making things confusing to read later.  
You're failing to properly edit it into the most sensible and 
understandable style, and therefore you're not living up to your 
claimed composition style.  I (unfortunately) spend a fair amount 
of time programming Basic, which cares nothing for indentation, 
and I absolutely *loathe* working with inconsistently indented 
(or unindented) code.  It is a joy to me that Python requires 
proper indentation, and I would say that any coding style that 
does not result in consistent indentation is a broken style.  You 
*need* to reindent code anyhow, to make it comprehensible, so 
complaining that Python requires that is silly.

(Besides, back when I used to do C++, when I refactored I always 
had to spend time doublechecking that both the moved code and the 
area it was cut from had the proper number of braces.  At least 
with indenting, the issue is easily visible.

-- 

Jeff Shannon
Technician/Programmer
Credit International



More information about the Python-list mailing list