Changeset 83

Show
Ignore:
Timestamp:
08/23/07 20:50:10 (1 year ago)
Author:
jkyllo
Message:

Expanded a couple docstrings.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/spike-20070613 tubes/tubes.py

    r81 r83  
    112112 
    113113class Singleton(object): 
    114     """An implementation of the Singleton pattern.  When a new Singleton is created, it first checks to see if an instance of its particular class exists.  If not, then a new instance is created.  After the created or stored instance is returned.  The Singleton is designed so that subclasses of Singleton inherit this ability thereby leaving only the implmentation work for the subclass. 
     114    """An implementation of the Singleton pattern.  When a new Singleton is 
     115    created, it first checks to see if an instance of its particular class 
     116    exists.  If not, then a new instance is created.  Afterwards the created or 
     117    stored instance is returned.  The Singleton is designed so that subclasses 
     118    of Singleton inherit this ability thereby leaving only the implmentation 
     119    work for the subclass. 
    115120 
    116121    >>> class Test(Singleton): 
     
    131136 
    132137    def __new__(cls, *args, **kwargs): 
    133         """Overrides default object creation to ensure that only one instance per class is ever returned.  These instances are stored in a dictionary on the Singleton class that is keyed on the type of the object being created.""" 
     138        """Overrides default object creation to ensure that only one instance 
     139        per class is ever returned.  These instances are stored in a dictionary 
     140        on the Singleton class that is keyed on the type of the object being 
     141        created.""" 
    134142        if not Singleton.__singletons.has_key(cls): 
    135143            Singleton.__singletons[cls] = None