A modest indentation proposal

Laura Creighton lac at strakt.com
Mon Dec 3 11:17:33 EST 2001


I think that you will have a better chance of getting your management
to let you use Python if you start using it yourself for some open
source project that interests you and get good enough at it that you
are so enthusiastic about the other virtues of Python that you no
longer care about indentation, and know deep down that nobody else
should either.

You might want to take a look at the last 3 weeks of the anygui project.
http://anygui.sourceforge.net  (But its easier to read the maling list at
http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/anygui-devel)

2 weeks ago we had a cool idea. If we used Python weakrefs, we could
write a dispatcher, and that would make the problems of garbage
collection much smaller.  The problem was that few or none of us knew
how weakrefs actually worked.  We talked about it for 2 days and then,
as hackers who don't understand what they are doing like to do, we
went and wrote code.  In four days 5 people, working independently,
produced _7_ working dispatchers.  The joke was that I was the only
one who hadn't written a dispatcher. And the only reason I didn't
write one, was that I have only been programming in Python every day
for 6 months.  So I am too slow for the company I am keeping; I
couldn't write a dispatcher quickly enough.  I think I could write one
in 10 days.  And Joe Knapka and Patrick O'Brien each wrote _two_
dispatchers in four days.  These were not toy prototypes; they do
useful work.  Paolo Invernizzi and I, who each needed a dispatcher for
our own purposes for a prototype in our respective workplaces, each
took one of these dispatchers and installed it at work in our
prototypes.  Patrick O'Brien made a recipe out of his dispatcher
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/87056.  You
can find pointers to most of the rest of them at
http://aspn.activestate.com/ASPN/Mail/Message/909131.

The reason your management should want Python is because it exposes
you to less risk.  Instead of spending all your time in wretched
planning meetings where people make decisions about what code we all
are going to write, based on what somebody has read about what it is
supposed to be like somewhere, you can tell the advocates of differing
approaches to come back in four days with a prototype.  Then you can
look at the code and say useful things like 'this design will never
scale' and 'this is a really difficult part' and 'oops we never
thought of that before' .... while all the rest of the world is busy
in a meeting yapping about what the ideal implentation of the ideal
design would look like.  You generate designs faster, and you can
throw the worse ones away.

You can read the anygui archives to watch us do a lot of that, as
well.  Note that a lot of the ideas we threw away would be _adopted_
by other non Python projects.  They were good ideas.  We just had
_even_ _better_ _ones_.  (Indeed, after all of this, we considered not
using _any_ weakref version _at all_.)

The reason everybody wants Python is because it shortens the list of
'cool things that I would like to do, but I will never get done in
time before I die'.  Your semicolon proposal is, at this point, worse
than irrelevant.  It is _irritating_ to have to type semi-colons and
brackets, when you are used to not having to.  Every time I have to
write something in C, I am _annoyed_ at this.  And this is the case
with every person I know of who has had the pleasure of writing all
their code in Python for a few months.  It spoils you, and makes using
certain other languages _irritating_.

In March, I set me the goal of reading every comp.lang.python article
that has been archived.  Years and years of this stuff.  I am almost
finished, (and if any of you are considering this, my suggestion is
_don't_ do this, it is _not_ time effective).  But this gives me an
interesting perspective.  Many, many, many people who start using
Python come with the idea that the shortcomings of the language they
are most used to, are shortcomings of programming languages in
general.  They perceive what they think is the same weakness in
Python, and immediately propose that this defect be rectified.  The
existing Python community says something on the order of 'this problem
that you are worrying about, really isn't a problem for Python
programmers'.  The newcomer shakes his head, and thinks that the
Python community is nuts.  Six months go by.  The newcomer has in the
meantime been posting much more interesting Python questions to the
list that indicate that he or she has been using the language to do
something fairly interesting (or at least complicated. <grin>).  And a
brand new Python novice comes in with fears that Python has this
horrible defect that they recognise from their experience with
programming language Z.  And this time, newcomer, six months more
experienced with Python, is among the _first_ to say, 'you know, this
really isn't a problem for Python programmers'.

So I think that the only real solution to your management's worries
about indentation is to let them program, or watch you program in
Python for six months or so.  (And maybe a copy of pychecker will ease
their fears.)  You need a different argument to get them to let you
use Python in the first place, but fortunately you will have one after
you personally start using Python for six months; and that one will be
'look at how incredibly productive I am in Python'.  Of course this
implies waiting until you have been programming in Python long enough
to get the incredible, near miraculous boost in productivity you have
always wanted.  (At which point, I predict, semicolons, brakets, and
other clutter will bother you as well, and you will hate your
proposal.)

If this pitch does not work, then it will be extremely difficult for
you to sell your management on _anything_.  If they truly cannot see
how being this much more productive can expose them to much less risk,
and they are so incredibly risk adverse that your proposal, which
amounts to a _coding standard_ is a hot, serious, topic, then it may
be hopeless.  It will take a high degree of negotiating skill in any
case, and one focused on getting your management to dream again.  This
is very hard work, which I have done too much of.  I've successfully
made large government agencies who had such a mindset change their
policies, but that was only because I recognised that nobody in
management there actually gave a damn about minimizing _risk_, and
minimizing _failure_ was also not a top priority.  Failure was
_expected_, but what was important was that when it failed, CBS News
and Time Magazine would not understand _why_ it failed, and so
couldn't write a nasty article saying that everybody at the Agency
were negligent fools who waste taxpayers money.

You are at Nasa.  This may be your management's position as well.  If
so, recall, if you use Python, and your project fails in some way
interesting to journalists, then they will say that it failed because
Python uses whitespace for indentation.  This is something that every
journalist can understand, and it will feed their egos and make them
feel like God to think that those fancy technical experts botched
something and _I_ _FOUND_ _THEM_ _OUT_.  So they will say this, _even
if_ the true reason that your project failed was that in your C++
extension you passed an array of X when you meant to pass an array of
Y.  Journalists lie, and every idiot journalist on the planet is going
to wish to believe that a failure was caused by indentation.  You
cannot get around this risk.  And no amount of redesigning Python can
help the problem that the profession of journalist is so full of
ego-driven, obnoxious dabblers, inordinately fond of their superficial
knowledge and who, seemingly incapable of any creative acts of their
own take an obscene and petty joy in preventing creativity in others.

I don't have time to write more.  Magnus Lie Hetland, Benevolent
Dictator for A While of the anygui project has decided, that despite
his having an exam on Friday, and his getting out of the hospital from
knee surgery, that we are going to have a beta release _this Friday_.
I have code to write.

But I wish you the very best of luck, since I care about space a lot,
and I think that Nasa missions would be a lot safer if they used more
Python and less C++.

Laura Creighton




More information about the Python-list mailing list