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

Arie van Wingerden xapwing at gmail.com
Wed Nov 25 11:12:58 EST 2015


>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.
Some languages are "better" in that specific case in my opinion (mind te
double quotes :-)
   - Ada and Pascal use := instead of = which is simpler to grasp for n00bs
(I think)
   - Erlang uses pattern matching. So when left hand side does NOT right
hand side, yuou get an exception.
         Each variable can be only assigned once and only once.
         That is the most purely mathematical approach (I think)
   - Haskell


2015-11-25 16:13 GMT+01:00 Ned Batchelder <ned at nedbatchelder.com>:

> 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.
> --
> https://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list