[Tutor] origins bootstrapped.

Avi Gross avigross at verizon.net
Wed Nov 21 11:31:59 EST 2018


Alan has been involved with Python for a long time so he has more to offer
historically.

I don't see some things as either/or. You can start with one major
motivation and it morphs from a one-celled creature like an Amoeba to a
complex vertebrate like a Python which needs modules added so it can walk
around better.

OK, horrible analogy but interesting naming. So some say Guido started with
learning his ABC and then became educated enough to understand Monty Python
and reach for the holy grail.

OK, even worse. Time to get serious.

I have seen this on many projects, not just programming languages and
environments. Something fairly simple is imagined then perhaps prototyped.
Someone may notice that what was created may be used in another way if
perhaps expanded a bit. Someone then realizes they now have functionality
that can be used to create something else, in a form of bootstrapping. After
a while they have a collection of tools that can be combined to make
something more complex. The biological analogy above can be an example. No,
I am not saying that a distant ancestor of a snake like a python was an
amoeba. But they do share common ancestors they have both diverged from with
the amoeba remaining a single celled organism and the python descending from
something that became multi-cellular then differentiated into having
different kinds of cells in tissues and organs and became a somewhat
integrated whole that is possibly more than the sum of its parts. The ABC
analogy is also obvious. Once an alphabet is chosen and provisional meanings
given to each letter, it can grow and even adjust to making words and
sentences and even seemingly endless streams of consciousness like some of
my messages.

Python was built on top of other achievements that some people were learning
from. There were many steps along the way from building machines programmed
one byte at a time in binary (I hated a class that made me do that as one
error means start over) to various levels where a compiler and then an
interpreter would parse things. We have been discussing using regular
expressions. Much of a language like python is having bits and pieces of
code written in ASCII or Unicode be parsed using hopefully unambiguous rules
into tokens that can be made into decision trees or whatever data structure.
That deepens on being able to look for and find some sort of pattern in
strings. I am not sure what python and others use, but it may be tools
similar to string search or regular expressions that allows them to
bootstrap.

Back when my group was programming in C, I was sent to Denver for a class in
Lex/Yacc to learn how to use C libraries that now look primitive. One was a
lexical analyzer and the other sort of a parser somewhat rudely named as Yet
Another Compiler-Compiler.

But today, what do most people use? Our tools improve, often by being a
wrapper to older tools and so on for multiple levels. New functionality is
added too.

Can I ask a question that I really want an opinion on? As a preface, I see
some think python as a formal language is being pushed by industry in
directions that may not meld as well for its use in other contexts like for
teaching students. How much of that is due to it being a relative open and
free product? There are plenty of other applications that you pay for and
thus have to be responsive to the buyers to remain in business. Python has
many implementations including some freer than others. Yet is has gone
through a bit of a bifurcation and many would like to see 2.X retained and
others wish everyone should migrate. Is there room for a smaller core
language that remains good for teaching purposes and that is small enough to
fit in a Rasberry pi, while other versions are of industrial strength? Do we
already sort of have some of that?

I was thinking of how many languages and environments have been looking at
working using parallelism. Most people simply have no need for the
complication. When you add the ability to do multiprocessing within an
application using something like threads, you spend lots of time making sure
you literally lock down shared resources so they are used serially. You need
to make sure race conditions do not lock up all your threads at once. Lots
of added overhead is only worth it if you gain in the process. Add multiple
cores in your CPU, and you may need to handle more complications as they are
actually running in parallel, perhaps still sharing a common memory. Allow
it to use multiple processors around the world, and you need even more
elaborate control structures to synchronize all that.

It definitely is worth doing but does everyone need it especially for
teaching an intro class?

I was thinking about the little project I mentioned the other day. Should
some of it be done in parallel using methods available? One part of the
problem was to read in N files into N pandas DataFrame objects. I knew that
I/O tends to be fairly slow and most programs take a nap while waiting. In
this case, a nontrivial amount of CPU is involved after reading in dozens of
lines to try to recognize the likely type of each intended column and then
process the data read in and continue reading more and processing it perhaps
while also looking to see if any additional data indicates an error. So the
CPU usage may be nontrivial and perhaps even lag the I/O timeframe at times.


An obvious speedup might be had by starting up N threads with each opening
one file and doing what I said above into one shared process with N
variables now available. But will it be faster? Should they all start at
once, or maybe follow each other every tenth of a second? If N is huge,
should we have a queue that starts up M copies and replenishes them as
threads complete? Should the actual files be moved onto multiple hard disks
because the total I/O from one disk may be maxed out or even degraded by too
many requests in random areas of the disk? Lots of questions like that but I
have to head out so I will pause and simply say that I opted not to bother
as the darn program finished in 5 or 10 seconds.

For heavy industrial uses, like some of the applications in the cloud
dealing with huge problems, it may well be worth it.

-----Original Message-----
From: Tutor <tutor-bounces+avigross=verizon.net at python.org> On Behalf Of
Alan Gauld via Tutor
Sent: Wednesday, November 21, 2018 5:31 AM
To: tutor at python.org
Subject: Re: [Tutor] Pythonic way

On 20/11/2018 22:35, Steven D'Aprano wrote:
> On Tue, Nov 20, 2018 at 08:22:01PM +0000, Alan Gauld via Tutor wrote:
> 
>> I think that's a very deliberate feature of Python going back to its 
>> original purpose of being a teaching language that can be used beyond 
>> the classroom.
> 
> I don't think that is correct -- everything I've read is that Guido 
> designed Python as a scripting language for use in the "Amoeba"
> operating system.

I think both are true. Guido was working on Amoeba at the time he built
Python so it was an obvious choice of platform, although he first built it
on a Mac. But he didn't set out specifically to build a scripting language
for Amoeba but rather to build "a descendant of ABC" which was also usable
in the real world, specifically The C/Unix world.

To do that he believed it had to address the major barriers to ABC which
were 1)being capable of being extended and 2) improved I/O.

My source for that conclusion is Guido's forward to "Programming Python" 1st
edition.

https://www.python.org/doc/essays/foreword/

Also his comments when he set up the "Computer Programming for Everybody"
initiative, which he led for several years. (Which I can't locate...)

So I believe that ease of teaching was definitely part of the original game
plan and was definitely a factor in some of the later developments around
v2.0 or so.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list