Least used builtins?

Arthur ajs at optonline.net
Sat Jul 5 10:40:43 EDT 2003


Lulu writes -

>Yet a fourth matter is that I think it would be slightly easier to teach
>Python to beginners if __builtins__ did not include a number of
>functions that were extremely difficult to explain to novices... and
>that are really only of use to fairly expert Pythoneers.  I find that
>callable, classmethod, id, intern, and a number of others fall in this
>category.  My thinking is that anything meant for experts should need to
>get imported by specific request.

Python and beginners.  As usual where I feel qualified to pop-up with a
position.

My experience was such that, in retrospect, the only place I feel Python
"betrayed" me as someone learning to program with Python and outside of a
formal curricula, was in the *absence* of a built-in - "copy".  To me,  that
absence left a conceptual hole in the core (not filled, I contend, by the
availability of list[:]).

I don't think it is necessary to elaborate in too much detail as to the why
the issue is an issue.  The full implications of moving something like copy
to become a built_in is not something I pretend to have a handle on.  As to
the limited question, effect on learning (especially self-directed
learning) - I believe I have a point.

Guido's position seems to be that the presence of copy as a built-in would
lead to its overuse by the newbie.  My counter-position is that it necessary
to understand why one is not using it, and that can only happen if one
understand it exists.

The thinking along the lines of a more limited set of built_ins might
actually serve some resolution of the issue -  at least to the extent it is
an issue, beyond my own perception of the matter.  That is, one will
understand sooner that there is functionality conceptually "fundamental",
that might not exist in __builtins__.

I also happen to agree with the direct point being made.

As I happen to be working on a short tutorial for an app, which assumes no
prior knowledge of Python.

And one the the first things I do - maybe 10 lines into the tutorial - is a
dir(__builtins__) from the interactive prompt. Just to give some lay of the
land.

Three or four years into Python, and I do notice there are a number of items
I can't explain to myself, much less to sombody else.  And have gotten a
fairly long way along writing acutal working apps, with the "more
fundamental" subset of __builtins_ which are in common use.

This whole area, I think, deserving of attention - especially as I do think
something siginificant might be accomplished without really disturbing
anything.  And perhaps the concept of whittling down the _builtins__, makes
more sense than the addition of a new built-in, as I had been advocating.
And would accomplish something along the lines that my experience indicates
to be advisable - i.e., with respect to "copy"

Art







More information about the Python-list mailing list