[Edu-sig] Python teacher notes, preparing for class...

kirby urner kirby.urner at gmail.com
Mon Aug 27 20:12:13 EDT 2018


My flight plan for sharing Python this evening, adult audience, real time
in cyberspace, includes going backstage to survey the Python for Developers
view.

That will mean optionally cloning the Github site that's mainly a Sphinx
HTML document about how to participate in Python's evolution.

https://github.com/python/devguide  (show how Sphinx works)

I don't plan on actually compiling Python tonight, but we'll be right where
one needs to be to learn how.  Just looking at the issues tracker (first
time) and PEPs (again) will inspire students with how well-oiled a machine
is the Python "sausage making" factory.

In my estimation, a well-rounded knowledge of Python includes understanding
how to make one's own decorators and context managers.

The following categories of type should also be made clear:

* Mutable vs Immutable
* Callable vs not
* Collections: Sequences vs Mappings
* Iterator vs Iterable
* Generator as Iterator
* Context Manager
* Descriptor

We recognize these types based on the assortment of "__ribs__" (special
names) they contain e.g. callables have __call__, mutables support
__setitem__, iterators have __next__, context managers __enter__ and
__exit__, Descriptors __fget__, __fset__ and so on.  We're like bird
watcher with binoculars, identifying species based on these tell-tale
characteristics (APIs).

A grand synthesis involves using the @contextmanager decorator from
contextlib to turn a generator into a context manager.  That's a high point
(summit) in my curriculum.

The Descriptor concept works in tandem with decorator syntax to bring us
the @property type.  I use a "magic circle" type for properties, meaning
you can set radius or circumference or area of a Circle, and the other two
attributes reset automatically.  I believe Raymond Hettinger uses the same
approach.

One of my most computer sciency types is the Permutation class, with many
soft links to Group Theory.  My P class randomly generates a dict with
[a-z] plus space (' ') mapped to the same set, keys to values in a
different order.  I have voluminous writings on how one might use this
class to explore elementary group theory on math-teach @ Math Forum, public
archives, no longer open to new comments.

https://repl.it/@kurner/Permutations
http://mathforum.org/kb/message.jspa?messageID=10227508
https://github.com/4dsolutions/Python5/blob/master/Permutations.ipynb

Kirby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20180827/50df4343/attachment.html>


More information about the Edu-sig mailing list