[Edu-sig] Python for Beginners

kirby urner kirby.urner at gmail.com
Thu May 22 03:13:00 CEST 2008

For true beginners, I think we should leverage their experience with
The Web, assume that as a given, and seek analogies on that basis.

We needn't begin with any model of "computer memory" in the sense of
some individual standalone machine with a flash drive and RAM.

So how about we teach that names are like aliases for URLs, objects
like websites?

There's a kind of DNS service in Python where the alias maps to the
actual IP number of the host, which'd be like going id(x).

When you use dot notation, other syntax, against a name, e.g.
dog.eat(dog), you're like "sending a message" (Smalltalk image) to a
website (object) at some id number (like an ip number), thereby
invoking a method, changing its state maybe.

x = y involves "emailing" an URL from y to x, setting up a second
alias. Recipient x now has a copy of the same URL as y, but no website
got copied.

This conforms to how people generally share websites, by passing
hyperlinks by email.

x, a name, is like "a portal" to the object it names.

type(x) will give you some insight into what services are offered.

dir(x) or help(x) also come in handy.

This fits our model of the web in that web pages don't really know
what other pages link to them (a little difference is PyObjects keep
track of "how many").

We're also used to websites being "more than just data" these days,
i.e. they offer services, which is characteristic of objects more

This'll be good prep for xml-rpc etc.

We also know that web pages themselves may contain links to other web
pages and so on, which reminds us of how collections work (links to

Some objects, like some websites, are static, like 8 (a simple set of
services, read-only, still an object though).

Leveraging experience with animals is another way to go (it's not either/or).

Because every object has a __rib__ cage (inheriting from object), we
might say "everything is a snake" in Python (meaning an object with

Some snakes quack like ducks though.


More information about the Edu-sig mailing list