apologies for formatting, striving for better readability this time... not repeating the source code, just the other part.
Reformatted: ----------- From: kirby urner <kirby.ur...@gmail.com> Date: Thu, Jul 21, 2016 at 2:02 PM Subject: Re: teaching Python 3.5 in 2016: snapshot To: "edu-sig@python.org" <edu-sig@python.org> My "arc" (trajectory) for teaching Python is something like: >>> dir() >>> dir(__builtins__) >>> type(3) >>> type('A') >>> import math ... using Python as a calculator and wordprocessor, including file i/o (open, close, 'r' 'w' 'a') >>> list, tuple, dict >>> immutability vs. mutability, explaining how ([], []) is an immutable "containing" mutables. >>> import collections.namedtuple ... dot notation access to Atom(protons=, symbol=, long_name=, mass=) talk about APIs as: car dashboard (driverless car controversies); web APIs (point to API companies like Apigee, Google, programmable web). Linking Object.verb() and Object.noun to API concept also (docstrings = owner's manual / user's manaul -- but not a repair manual, which is for #comments in source code and tests). tell stories about Browser Wars, emergence of browser as universal client, HTTP as API, RESTful vs SOAP web services, play with existing APIs that return JSON >>> string formatting with new mini-language feature set >>> def function() notation, arguments vs parameters ... *args, **kwargs as either >>> save function objects to a list, show functions as ... top-level, lambda syntax >>> class Element: that mimics namedtuple Atom. .... Compare side-by-side >>> composer.py (introduce operator overloading) now show how "namedtuple" API may be duplicated using __getitem__ >From here on, we're prepared to use special names (or "__ribs__" as I sometimes call them) as a way to talk about APIs. E.g. * the iterator protocol around __next__ and __iter__ may now be presented using classes. * Context managers (__enter__, __exit__) * Descriptors (__set__ and __get__) We'll get to some of these below, after decorator syntax... >>> inheritance, MRO (method resolution order) >>> old fashioned menu-driven API based in input() to do ....CRUD against all_elements # <--- this is where I'm at in the current 5-week course I'm teaching >>> annotations What I call "grand unification" is up ahead where we show how a context manager maybe be built with generator as a decorator. Haven't gotten there yet with this class. That's almost black belt, like maybe brown. ====
_______________________________________________ Edu-sig mailing list Edu-sig@python.org https://mail.python.org/mailman/listinfo/edu-sig