[marketing-python] Re: How popular is Python? What sort of things can we measure?
Kirby Urner
urnerk at qwest.net
Fri, 12 Sep 2003 17:27:22 -0700
At 10:43 AM 9/12/2003, Dylan Reinhardt wrote:
> > I think it's a marketing point for Python that it's easy and
> > straightforward enough to enable a person to do programming,
> > as a form of recreation -- just because it's fun.
>
>This, I think, is the real point and the main reason I feel compelled to
>bring up the discussion. Marketing Python as "easy" is likely to cause
>us at least as much harm as good if we aren't careful about how we
>contextualize ease of use.
>
>I'm all for broadening Python's appeal and extending new opportunities
>to learn it. At the same time, let's be very careful about creating the
>impression that Python is so powerful that it makes experience
>irrelevant. We're aren't doing anyone any favors by undercutting the
>professionals who are already using the language. If we deplete the
>Python economy, no amount of argumentation will save the day.
>
>Dylan
Sure, we're not making experience irrelevant.
In mathematics classrooms, the competition is not career programmers,
but calculators.
Python in shell mode is as easy as using a calculator, I'd say easier in
many applications (e.g. where big integers are concerned, or file i/o).
This is where Guido's tutorial starts: using Python as a calculator.
A beginning lesson might be to list triangular numbers: 0, 1, 3, 6, 10...
Programming a calculator would probably *not* be as easy as just
going:
>>> [n*(n+1)/2 for n in range(10)]
[0, 1, 3, 6, 10, 15, 21, 28, 36, 45]
And suppose we want successive rows of Pascal's Triangle?
Again, Python is probably easier to program than a calculator here:
>>> def pascal():
row = [1]
while True:
yield row
row = [i+j for (i,j) in zip([0] + row, row + [0])]
>>> gen = pascal()
>>> for i in range(10):
print gen.next()
[1]
[1, 1]
[1, 2, 1]
[1, 3, 3, 1]
[1, 4, 6, 4, 1]
[1, 5, 10, 10, 5, 1]
[1, 6, 15, 20, 15, 6, 1]
[1, 7, 21, 35, 35, 21, 7, 1]
[1, 8, 28, 56, 70, 56, 28, 8, 1]
[1, 9, 36, 84, 126, 126, 84, 36, 9, 1]
Not that using a generator is the only way. But it's a nifty demo of
what generators are good for.
Of course modern calculators like the TI-96 will do symbolic integration
and such, which is something for career programmers to worry about coding.
This gets into Mathematica territory.
But for a lot of stuff, getting to do it in code makes the processes
seem less obscure, plus takes the tedium out of repetitive calcs, such
as rotating a polyhedron by multiplying each of its many vertices by some
3x3 matrix (going 3d is another thing computers have over calculators).
Math notation becomes more readable once you make the connection between
Sigma notation (say) and indexed loops around a cumulative addition
statement. Pi notation is the same thing, but uses cumulative
multiplication.
Doing linear algebra with Numeric at your elbow would likewise prove a
boon. Or code some of the algorithms yourself, just to get a feel for
what makes 'em tick.
Here's an example of some higher level number theory stuff, with
Python mixed in:
http://www.mathforum.org/epigone/math-teach/blerlplerdghi
The goal is to encourage students to just tinker around, using Python
as a base language instead of some 1980s solution like BASIC. Math
provides an endless source of raw material (little programming
challenges), at all levels.
We'll get some new career programmers and computer scientists out of
all this, sure, but that's not the primary goal of the curriculum.
Writing little programs like this could easily be seen as akin to knowing
how to use a calculator. It's just basic stuff.
Kirby