do...until wisdom needed...

Steve Lamb grey at despair.rpglink.com
Tue Apr 17 17:49:03 EDT 2001


On 17 Apr 2001 17:00:43 -0400, Douglas Alan <nessus at mit.edu> wrote:
>A common answer I see in this newsgroup is that Python gives you a
>long rope.  For instance, when people complain that they get bugs due
>to accidentally assigning to the wrong variable because variables
>don't have to be declared, people respond by saying that Python gives
>you a long rope.  These people apparently they don't want to suffer,
>even for significantly increased reliability, the very minor
>limitations that variables declarations would entail.  But then if
>someone complains that Python doesn't give them a long enough rope in
>some other area, the answer is that the proposed feature would allow
>poor programmers to write unreadable programms.  C'mon guys, be
>consistent!

    Personally I'd answer the former charge not with stating that Python gives
you a long rope, but that Python is doing the sensible thing.  Variable
declaration has to be one of the most tedious thing held over from programming
for a different aim.  

>Personally, I want a language that gives me all the rope I need, but
>doesn't make it a chore to write good programs.  Writing good programs
>in Perl is a chore; hence Perl sucks.  

    Perl gives you all the rope that you need.  Writing good programs in Perl
is not a chore.  Maintaining good programs in Perl is a chore.

>If Python had procedural macros, writing good programs would be less of a
>chore, not more of a chore.

    Writing good programs in Python now isn't a chore.  The more I program in
Perl, the more I want to program in Python because of the fact that there are
less ways to do something.  By giving macros you'd be giving more ways to do
something and lower the maintainability of the code.

    The problem isn't that the language isn't flexible enough; it is plenty
flexible for the aims it has.  The problem is that the programmers aren't
flexible enough in their laziness.  It is something that I've had to overcome
time and again in my Python programming because of my Perl background.  As
I've said, however, I prefer Python because I know that I'm quite likely to be
able to maintain someone else's three year old code without having to puzzle
over it for an hour and spend another three rewriting it to a maintainable
form.

>I don't want my language trying to force bad programmers to write good
>code.  If this is some sort of official design goal of Python, then it
>is a misguided and impossible one.

    I'd like to think that Python encourages programmers, good and bad, to
write maintainable/readable code.  The quality of the code is immaterial.
As many people have pointed out even the loosest of languages do not force you
to write bad code any more than the tightest of languages force you to write
good code.  In both cases it is entirely possible to add an element to an
array by first copying the array into another array and then adding the single
element instead of using a simple push() or .append().  

    The difference, however, in providing only what is needed and providing
6-12 different ways to express something, each with a slight variation on
behavior, is that in the former you only need to learn that one.

    do..until is just a loop with the exit clause near the end of the loop
instead of the beginning.  In Python, that is clear.  while is the loop
keyword, if cond: break is the ending condition.  No need to try to remember,
"OK, this looping keyword will iterate over the loop until the end except on a
full moon, in which case it will break before the first addition of two
integers unless it is also a Friday the 13th..."

>Regarding Perl, it is the worst attrocity foisted on humanity since
>the black plague.  

    Yet it provides exactly what you want, TIMTOWTDI.  

>> Any reasonably skilled programmer can learn every important part of
>> the Python syntax in less than a day.

>A macro capability doesn't detract from this.

    Yes, it does.  It means that a person, beginner or expert, has to relearn
a particular person's idioms before being able to do anything productive.  It
means every time you come in contact with a new person's programs you have to
relearn thier particular dialect of the language.  That is not something that
can be learned in a day.

>That's because Perl is the worst attrocity foisted on humanity since
>the black plague.

    Yet it offers exactly what you want.  So why, then, do you want to turn
Python into the worst attrocity foisted on humanity since the black plague?

>Any feature added a language makes the language less simple.  

    Any feature which adds a massive layer of complexity (macros) or is
redundant (do..until) add needless complexity without adding an appropriate
benefit.  A feature which is flat out missing and is not redundant of another
feature adds little complexity and a lot of appropriate benefit.

>Python is hardly a simple language anymore.  

    It is the simpliest of the several that I've come in contact with thus far
and I certainly appreciate it for that fact.

>A language should be easy to learn, but offer untold power.  

    Thus far I don't see many limits to Python's power because of its
simplicity.  All I see are programmers who are whining that they can't have
their favorite construct instead of learning a new way to do things.  Ironic
in that to implement their pet prodecure they are requiring everyone /ELSE/ to
learn something new.

>If Python had procedural macros, the language wouldn't be any harder to learn
>since this is not something a newbie would have to worry about for quite some
>time.  

    But is something that every expert would have to relearn each time they
tuch someone else's code.

>A bad programmer has many tools available to him in Python, as it is,
>to make hard to understand code.  I don't think it would go over well
>to remove useful features from the language to prevent this.

    This, of course, is also not an argument to add features which serve very
little purpose and add untold complexity.  You said you programmed quite
happily in Lisp for over a year without macros.  I contend that if the macros
weren't there you could have still programmed just as happily.

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------



More information about the Python-list mailing list