On Wed, Oct 6, 2010 at 4:16 AM, T MURPHY <t...@hotmail.com> wrote:
> how do i go about creating a class in python.

By using the "class" keyword.

Example:

class Fruit(object):

   def __init__(self, name)
      self.name = name

class Apple(Fruit):

   def __init__(self):
      super(Apple, self).__init__("apple")

apple = Apple()
print apple.name

For more information, I suggest you start reading
the python tutorial (1)

cheers
James

1. http://docs.python.org/tutorial/

-- 
-- James Mills
--
-- "Problems are solved by method"
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to