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

Class cNull

source code

A class for implementing Null objects.

This class ignores all parameters passed when constructing or calling instances and traps all attribute and method requests. Instances of it always (and reliably) do 'nothing'.

The code might benefit from implementing some further special Python methods depending on the context in which its instances are used. Especially when comparing and coercing Null objects the respective methods' implementation will depend very much on the environment and, hence, these special methods are not provided here.

Instance Methods
 
__init__(self, *args, **kwargs)
Ignore parameters.
source code
 
__call__(self, *args, **kwargs)
Ignore method calls.
source code
 
__getattr__(self, mname)
Ignore attribute requests.
source code
 
__setattr__(self, name, value)
Ignore attribute setting.
source code
 
__delattr__(self, name)
Ignore deleting attributes.
source code
 
__repr__(self)
Return a string representation.
source code
 
__str__(self)
Convert to a string and return it.
source code
 
__nonzero__(self) source code
 
__len__(self) source code