[Edu-sig] teaching Python etc.
Wes Turner
wes.turner at gmail.com
Tue Jul 25 12:03:03 EDT 2017
On Monday, July 24, 2017, kirby urner <kirby.urner at gmail.com> wrote:
>
> I turned down a $600/day 3 day gig I might not have got anyway, because
> the textbook goes twelve chapters with no 'class' keyword, and that would
> define the full complement of our topics. My code of conduct forbids
> teaching Python that way.
>
+1.
- "Namespaces are one honking great idea -- let's do more of those!"
- Classes are dicts with MRO.
https://en.wikipedia.org/wiki/C3_linearization#Example_demonstrated_in_Python
> The whole point of OOP was here's a way we think in natural language:
> about Things with properties and behaviors.
>
Maybe 'classes and instance of classes'. class Book(object): pass;
book_instance = Book()
> Maybe some people don't like to be "objectified" and it's true, that can
> mean something bad, but in the context of the Django ORM, it means an
> integrated object has the records.
>
ActiveRecord and DataMapper are both popular ORM patterns.
From
https://wrdrd.github.io/docs/consulting/knowledge-engineering#object-relational-mapping
:
Object Relational Mapping⬅
Wikipedia: https://en.wikipedia.org/wiki/Object-relational_mapping
- https://en.wikipedia.org/wiki/Data_mapper_pattern
- https://en.wikipedia.org/wiki/Active_record_pattern
https://en.wikipedia.org/wiki/Object-relational_impedance_mismatch
- https://en.wikipedia.org/wiki/List_of_object-relational_mapping_software
> The patient, the athlete, the student object, comes with a medical
> history. Lots of SQL behind the scenes.
>
Medical history as a schema / informatics example and Python:
- GNUhealth
- (an actual application (with an install procedure and/or just Docker)
with example/test data) -
https://en.wikibooks.org/wiki/GNU_Health/Different_ways_to_test_GNU_Health#Option_4:_Run_GNU_Health_from_Docker_.28Lightweight_Containers.29
- https://hub.docker.com/r/mbsolutions/postgres-gnuhealth/~/dockerfile/
- https://en.wikibooks.org/wiki/GNU_Health/The_Demo_database
-
https://hg.savannah.gnu.org/hgweb/health/file/tip/tryton/backend/fhir/server/fhir/patient.py
- lots of XML (which can be digitally signed)
- lots of boilerplate
- (this is in the the server API)
Normalization to records (rows) with fields (columns) and keys (identity)
AND/OR
Denormalization to composed, often nested, signable records (See: JSONLD,
ld-signatures, blockcerts)
> Rollicking good debate over on math-teach as we exult over the huge
> numbers turning out to take AP CS.[1] The Learn to Code movement is
> succeeding, has gained traction. The Coding with Kids that I work for has
> likewise spread to several more cities, and any successful business model
> attracts imitators (CwK has a great website for faculty, lets us track
> everything, including our hours). Is code school the new high school?
>
> https://medium.com/@kirbyurner/the-plight-of-high-school-
> math-teachers-c0faf0a6efe6
> (an essay coming up on its first anniversary)
>
> The $600/day gig was teaching adults (andragogy vs pedagogy), over the
> wire, which is how I've been making ends meet.
>
> Unfortunately for me, a truck pulled up across the street and started
> moving wires from pole A (the old one) to pole B (the new one) and wouldn't
> ya know, my Internet, which goes right through there, cut out.
>
> The crew said "not us" (what are the chances?) and took off. CenturyLink
> is coming tomorrow, but will they have a long enough ladder? I've gotta do
> my wind-up session 10 of 10 for the Californians. Patrick offered me his
> office (Comcast). I'm tethered to Internet through my cell phone as I write
> this (not enough bandwidth for live screen and audio though).
>
> We introduce Python classes early because that's the promise of OOP.
>
We could start with
import unittest
class Shape():
class Square():
class Rectangle():
class Triangle():
# def area(*args, **kwargs):
# def circumference(*args, **kwargs):
...
https://westurner.github.io/2016/10/17/teaching-test-driven-development-first.html
> To sucker for that "ontogeny recapitulates phylogeny" thesis, that we need
> to slog through a whole semester of procedural programming, before we make
> a single instance of something, is impossible in practice, at least in
> Python, as just about everything one touches is an instance of something.
> This textbook seems to hearken from that era (fortunately receding in the
> rear view mirror).
>
> You'd think in Java at least it'd be classes right out of the gate as one
> can't but extend a class to get anything done.
>
> Python's the same way of course; I think of functions as another type,
> canned (built-in), with their own syntax, but an instance of the
> FunctionType nonetheless.
>
FunctionType type annotation:
https://github.com/python/typeshed/blob/1e04a8c1b8b2c7a1fc3d9fcfbc2d3d8ba2dc933a/stdlib/3/types.pyi#L25
>
> Out here in Code School world, the pressure is on to teach Python in two
> main ways: as a web development language, using projects like Flask and
> Django, and as a Data Science tool, using pandas, numpy, Jupyter Notebooks
> and mathplotlib -- but then when it comes to visualization tools, there's a
> plethora of 2D options. Great talk on this at Pycon2017.
>
Mayavi (VTK), Blender
> I've always been more a 3D guy myself, writing to POV-Ray and later Visual
> Python. I had a good experience getting vpython over anaconda and
> embedding same in a Notebook, but that was a while ago. No one pays me for
> 3D stuff.
>
http://holoviews.org/ (Bokeh, Matplotlib, Plotly)
>
> Maybe we should learn to do stats that way, using more 3D models than we
> do. Fly through.
>
We manage to understand so much about data through 2D (+time)
visualizations that don't have 3D camera and viewport parameters to just
reset to the best view.
That said, these 3Blue1Brown professionally animated math videos are
outstanding (and sponsored!):
https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw
>
> Not just physics should have all the fun. As it is it seems precious few
> physics teachers take the "coding a physics engine" approach. Maybe
> Carnegie Mellon? I'm far from omniscient.
>
https://en.wikipedia.org/wiki/General_relativity#Relationship_with_quantum_theory
- /search computational physics and python
- /search physics simulation and python
- http://vpython.org/
- https://docs.blender.org/manual/en/dev/physics/
- Are there other good tools in {Python,} for evaluating complex systems at
a point in time? (I think we've had a similar discussion in the past.)
> Hey, TinkerCAD is loads of fun for simulating an Arduino, a great sandbox
> if you don't have all the components. I've made some screencasts showing
> that. [2]
>
Recently, I learned about LeoCAD (because LEGOs and a bricklayer.org
presentation):
https://github.com/westurner/wiki/wiki/bricklayer#bricklayer-jupyter-extension
>
> The Learn to Code movement is having a big impact, to summarize.
>
"Nine Policy Ideas to Make Computer Science Fundamental to K-12 Education"
https://code.org/files/Making_CS_Fundamental.pdf
>
> Kirby
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20170725/e7fc4b15/attachment.html>
More information about the Edu-sig
mailing list