On 1/26/06, Christopher Spears <[EMAIL PROTECTED]> wrote:

> headlights.  Where should I begin?  How do I go about
> designing a new class?

Some starter 101:

First, recognize that a class is a compound type that is not only a type
but binds other variables and methods with it.

#----------------------------------- class definition
class People(object):
         lastname = 'Spears'
         firstname = Chris

object is the parent of People from where People inherits all of its
definitions and behavior (functions). It's also called "subclassing" --
subclassing object to get People.

#----------------------------------- instantiation
p = People( )

p is called "an instance of class People"

>>> p.lastname
Spears
>>> p.firstname
Chris
>>> p.firstname = 'runsun'
>>> p.firstname
runsun


~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
Runsun Pan, PhD
[EMAIL PROTECTED]
Nat'l Center for Macromolecular Imaging
http://ncmi.bcm.tmc.edu/ncmi/
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to