[Tutor] class blast

Kirk Bailey idiot1 at netzero.net
Sat Aug 9 19:01:59 EDT 2003


OK, I wrote a couple of things:
def isin(str,substr):                           # this thing is a general tool.
         return 1+string.find(str,substr)        # it returns a logical 1 or 0
#                                               # for use in an IF statement.
#
def ishyperlink(word):                          # uses previous to detect a 
hyperlink
         return isin(word,'http://')             # if the target is in the word,

isin can be used to provide this functionality in the definition of other words.

Going back to the object/class chaos, I recall that objects have attributes and 
methods that can be the same in instances of a class( in fact, normally they ARE 
the same, only the data differ). But the data is different.

What I was doing was in effect creating a parent class and an instance of the 
class, with required data for it's operation hard coded into the definition.

Am I drilling in a dry hole here? Was the sound of a candle flaring into light 
over my head?

-- 

-- 

end

Cheers!
         Kirk D Bailey

  +                              think                                +
   http://www.howlermonkey.net  +-----+        http://www.tinylist.org
   http://www.listville.net     | BOX |  http://www.sacredelectron.org
   Thou art free"-ERIS          +-----+     'Got a light?'-Promethieus
  +                              think                                +

Fnord.





More information about the Tutor mailing list