Department of Geological and Atmospheric Sciences

Meteorology 227 - Python

Useful Python Packages

Useful Class Definitions

  • Class: The blueprint from which individual objects are created. Class of objects.
  • Object: Classes are templates for objects. Python is a collection of objects.
  • Instance: A specific or particular object of the class.
  • Attribute: A characteristic of the objects state.
  • Method: Define the how object interacts with the outside world.

  • When you create an object, you instantiate it, meaning you create an instance of it. Some books don't use instance, some do. Objects and an instance of an object are very similar. Don't get too caught up in the difference. You should also note that attributes and methods are object references, not usually instance references.

  • Example: I own a Dell XPS-13 computer. There are probably thousands, if not more, XPS-13's out there. They were all created from the same set of blueprints, a class of computer, and contain the same components. We would say that these computers are all objects. If you walked into a computer store, you would see a lot of Dell XPS-13 or objects all created from the same blueprint or class. My computer is an instance of one of these objects known as Dell XPS-13 computers. An attribute might be, for example, the processor speed, the amount of memory, the size of the hard drive, etc., while possible methods would be turnon, turnoff, startprogram, etc.