[Edu-sig] Introduction to object and "dot" notation: feedback wanted
andre.roberge at gmail.com
Thu Jan 19 03:23:42 CET 2006
On 1/18/06, kirby urner <kirby.urner at gmail.com> wrote:
> Just a quick note of approval re use of Dog class. You might want to
> lowercase fido, or not. I'm used to reserving capitals for the class
> definition, keeping all instances lower, but of course there's nothing much
> beyond taste to influence such decisions about style.
I thought about doing that ... but, then I thought I had been talking
about Reeborg (with a capital letter) all the time that it would look
artificial to suddenly use a lowercase letter. At the very least I
could put a note about the standard convention ... but I wonder if
this would be seen more as a distraction at this stage...(me
ambivalent?... maybe I am...)
> Plus I support your approach of focusing on dot notation as a critical step
> (my approach as well).
I realised after reading the lesson I wrote that I never explained in
words about how the "dot" connected an attribute/method to an instance
- I just showed it. Should I repeat it in words?
> I favor a first pass using existing Python objects, already dot-ready (e.g.
> lists and dictionaries), then an interlude defining functions, using the
> learned collection types, then back to dot notation again, but this time
> rolling your own classes (with metaclasses in some future pass).
Good idea... I have not written the lesson about lists (or any other
sequences yet) and just realised that I will have to introduce the dot
notation then (to show, at the very least, how to append items to a
list.) Perhaps I can modify your usual approach: introduce the dot
notation earlier (pretty much with the lesson I submitted for
comments) but with a mention that we will learn more about classes
later. Then, in the lesson immediately following it, introduce lists
AND lists methods. As for functions... The way rur-ple is structured,
the first Python keyword introduced is "def" to define new functions
in the robot world. Then it's if, else, elif, pass, not, while, ...
all of this before even introducing numbers, strings and variables.
> Possible mnemonic: yourdot-funk-mydot.
I wouldn't repeat that in front of my kids for fear of being misunderstood ;-)
More information about the Edu-sig