More Questions
Displaying 1-2 of 2 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
ltcmdstarbuck

It's about classes. I think I have an idea what they are. First off how do you normally call a function in a class? And second, can you assign global variables to a class sort of like costom properties?



Posted on 2001-10-05 09:04:32

andy

An example:

class Foo:
   def __init__(self):    # called when the object is created
      self.variable='hi!'

   def Print(self):
      print self.variable
# now we have a class defined, let's instantiate it and use it
bar=Foo()
bar.Print()
bar.variable='yo, sucka'
bar.Print()



"Ignorance is its own reward" -- Proverb

Posted on 2001-10-05 17:06:45


Displaying 1-2 of 2 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.