[Edu-sig] A request for Kirby
kirby.urner at gmail.com
Sat Sep 5 21:54:24 CEST 2009
On Sat, Sep 5, 2009 at 12:04 PM, Andre Roberge <andre.roberge at gmail.com>wrote:
> Dear Kirby,
> Many times on this list and elsewhere (
> http://mybizmo.blogspot.com/2006/08/python-pedagogy.html and
> http://controlroom.blogspot.com/2006/09/lunch-on-hawthorne.html) you have
> written about Python's special methods as "__ribs__". While you have
> given many examples ... it is difficult to find a single definitive link
> that others could be directed to, to learn about this approach (with links
> to other examples...).
> I think it would be very useful to all of us if you could come up with a
> "reasonably complete" single post (either on this list or on some other
> website) about __ribs__, starting from the beginning simple image,
> meandering in your own unique way to perhaps conclude with an example
> showing operator overloading (with fractions?) using Python's special
OK André, that's a reasonable request, let me attempt it in the short window
I have available before retrieving Lindsey for another try at passing DEQ
(should pass this time, thanks to recent visits to Nissan Nation)...
The idea of saying __ribs__ or __rib__ (singular) for Python's special names
is a way to turn Python's signature appearance into easy mnemonics i.e. this
will help kids (adults) learn.
is not street legal Python, but damn close.
A real Python class has __ribs__ like __init__, __add__, __repr__, __str__
and so forth.
The mnemonics here: Pythons are snakes, have long backbones (the
characteristic feature of snakes), lots (lots!) of ribs. So the language
Python, in addition to alluding to Monty Python, is very cleverly self
referential in terms of classes (types) having a kind of snake-like
structure, i.e. the methods stack up to for a "rib cage".
Of course not all method names are special names.
Another use of ribs is in the ribs of a ship or whale. There's the whole
idea of "container with guts" i.e. the containership metaphor of dot
notation is well supported by this view of a class as a kind of ship, also
The class definition is actually just the blueprint of a ship (or snake, or
other creature) and then we have *instances* of that, i.e. the actual
objects are the incarnated (built, constructed) thingies in memory. Just
talking basic OO here, nothing new, old hat.
Here's a picture from my notebooks that encourages these heuristics:
Of course in actual practice we're like building Biotum, Dog, Cat, Monkey,
Human, then inheriting from Mammal (polymorphism) in preparation for more
stark and austere "math objects" like Vector, Edge, Rational, Polynomial,
These latter may know to write themselves in scene description language
(POV-ray) or x3d, other formats, per examples at Oregon Curriculum Network
website (4dsolutions.net a private company sponsor).
http://www.4dsolutions.net/ocn/stickworks.html (instructional video)
PS: some of the best graphics introducing the rib concept are in my Vilnius
http://www.4dsolutions.net/presentations/connectingthedots.pdf (slides 9 -
12 in particular)
> Edu-sig mailing list
> Edu-sig at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Edu-sig