Late-binding of function defaults (was Re: What is a function parameter =[] for?)

Ned Batchelder ned at nedbatchelder.com
Wed Nov 25 10:13:41 EST 2015


On Wednesday, November 25, 2015 at 8:20:59 AM UTC-5, BartC wrote:
> Accept that some things /are/ a source of confusion. When, in writing 
> documentation, I find something hard to explain something, then I try 
> and make it simpler in the program. But not enough of that goes on: it 
> seems to be more lucrative to write thicker user manuals, and provide 
> longer training courses, than to make software simpler.

You seem to be insinuating that someone has made Python unusually complex
for personal gain?  I'm not sure what to do with that: it's an absurd
claim.  

> > "Why does the loop run forever?"
> >
> > The coin doesn't magically toss itself, no matter how intuitively obvious it
> > is that it should.
> 
> The concept of variables doesn't take long to learn in an 'ordinary' 
> language.

There is a natural tension between making a language simple enough that
it has no surprises or difficult parts; and making a language rich
enough that it can be used for building serious systems.

If you have another language to propose as a better beginner's learning
language, please propose it.  I think it serves beginners better to
teach them with a language that they can then go on to use for building
real things.  Is there a real language (an "ordinary" language) that
you think is better than Python for that?  Empirical evidence in the
world says, "not really."

I know you have languages of your own, and that you like the way they
work better.  We have no way of evaluating their power or simplicity,
since they are not available to us.

I agree with you: there are things about Python that surprise people.
That's because it's a programming language, and very very little about
programming languages is obvious.  The best we can hope for is "familiar,"
and even then, familiar to who?  High school algebra students will at
first be baffled by "x = x + 1", an equation which is clearly
unsatisfiable.

So yes, there are parts of Python that are hard, and surprising. There
are subtleties that require study and careful thought.  We believe that
on the balance, Python is better than many of the alternatives. You
are welcome to disagree, but don't be surprised if you encounter
vigorous counter-arguments in a Python mailing list!

There isn't much we can do about the structure of the language, certainly
not the parts that have been discussed in this thread.  The best we can
do is try to explain it better.

--Ned.



More information about the Python-list mailing list