[Pipet Devel] pygtools tutorial - some definitions

Danny Rice dwrice at indiana.edu
Wed Jun 2 10:55:50 EDT 1999

>Here is a Python example:
>MyClass:                             # A new class is defined.
>    def my_method(self, my_number):  # A new method is defined
>                                     # with the parameter "my_number".
>        self.my_object = number      # A new object is defined.

What is "self" here?  A generic parameter or something special?
Has "my_object" been declared somewhere else?  Should number be

>my_intance = MyClass()               # An instance is made.
>my_instance.my_method(2)             # The method is called.

Why is only 1 parameter passed?

>print my_instance.my_object          # This will print "2".

It seems like you would need something like "print
my_instance.my_method.my_object" in case you had multiple methods
under the class.

This is all pretty confusing to me.

Danny Rice

More information about the Pipet-Devel mailing list