[Chicago] History of programming

kirby urner kirby.urner at gmail.com
Wed May 27 15:53:03 CEST 2015


On Wed, May 27, 2015 at 6:11 AM, Jason Wirth <wirth.jason at gmail.com> wrote:


Kirby that notion if eater is an interesting metaphor i haven't year heard
> to explain the concept.
>

Yeah, the () after obj() looks like the emoticon mouth. ;-()

So I tell kids a callable "has a mouth" even if arguments are optional.  ()
triggers __call__.

That takes me to talking about __ribs__ (my word for special or magic
names) as Pythons have lots of __ribs__ (mnemonic).

A class definition may have a __rib__ cage as when lots of magic method
behaviors get defined (__call__ included).

In Python4 (class I teach), we have a Composable class such that even
though <class 'function'> type objects don't multiply, e.g. h = f * g makes
no sense, out of the box, we go:

>>> f = Composable(f)
>>> g = Composable(g)
>>> h = f * g

and then h(x) == f(g(x)) i.e. to multiply is to compose.  For an exercise,
the students implement __pow__ such that  (f ** 5)(x) == f(f(f(f(f(x))))).

Identity function:  Composable(lambda x: x) e.g. f ** 0.


> I'm fascinated by how the words we use highlight or hide certain aspects
> of the concepts we seek to explain.
>
> Likewise, language and metaphor play a huge role in teaching and learning.
> How many times have idea been circularly explained? Eg
> "A callable is something that can be called." Haha.
>

A callable implements __call__ would be better.


>
> PS you are in Portland? I suspect your couch, guest bedrooms, and all
> available floor space will be full in about 10 months from now. :)
>

10 weeks you mean right?

Check with me closer to the time.  I do have a housemate in Nepal right now
who needs some R&R before returning in August.  When she's away, her room
is available as a guest room.  Also my 86 year old mom lives here in summer
months.

Lets get together in any case and quaff a cold one or two.

Kirby

PS:  I was born in Chicago if that matters (asserting my Chipy credentials)
-- came to Djangocon in 2013, after which I made a short Youtube with more
metaphors:   http://worldgame.blogspot.com/2013/09/leveraging-python.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20150527/e70de7e2/attachment.html>


More information about the Chicago mailing list