Package Gnumed :: Package pycommon :: Module gmNull
[frames] | no frames]

Module gmNull

source code

null.py

This is a sample implementation of the 'Null Object' design pattern.

Roughly, the goal with Null objects is to provide an 'intelligent' replacement for the often used primitive data type None in Python or Null (or Null pointers) in other languages. These are used for many purposes including the important case where one member of some group of otherwise similar elements is special for whatever reason. Most often this results in conditional statements to distinguish between ordinary elements and the primitive Null value.

Among the advantages of using Null objects are the following:

To cope with the disadvantage of creating large numbers of passive objects that do nothing but occupy memory space Null objects are often combined with the Singleton pattern.

For more information use any internet search engine and look for combinations of these words: Null, object, design and pattern.

Dinu C. Gherman, August 2001

For modifications see CVS changelog below.

Karsten Hilbert July 2004


Version: $Revision: 1.6 $

Author: Dinu C. Gherman

License: GPL v2 or later (details at http://www.gnu.org)

Classes
  cNull
A class for implementing Null objects.
Functions
 
test()
Perform some decent tests, or rather: demos.
source code
Variables
  __package__ = None