Mega Code Archive

 
Categories / Python / Class
 

Define a class

class MyClass:     "A simple example class"     i = 12345     def f(self):         return 'hello world' #__doc__ is also a valid attribute, returning the docstring belonging to the class:  #"A simple example class".