class Cosmology_Bug:  # Old Style!
    def __init__(self,value):
        self._omega_dm = value

    def __str__(self):
        return "Omega_DM = "+str(self._omega_dm)

######################################################################################

class Cosmology (object):
    def __init__(self):
        self._omega_dm = None

    def getdm(self):
        return self._omega_dm

    def setdm(self, value):
        if value < 0:
            raise ValueError("Must be >= 0")
        self._omega_dm = value

    def deldm(self):
        del self._omega_dm

    omega_dm = property(getdm, setdm, deldm, "I'm the Dark Matter density property.")

    def __str__(self):
        if self.omega_dm==None:
            raise ValueError("Omega_DM not set")
        else:
            return "Omega_DM = "+str(self.omega_dm)

######################################################################################

class Cosmology_Decorator (object):
    def __init__(self):
        self._omega_dm = None

    @property
    def omega_dm(self):
        """I'm the Dark Matter density property."""
        return self._omega_dm

    @omega_dm.setter
    def omega_dm(self, value):
        if value < 0:
            raise ValueError("Must be >= 0")
        else:
            self._omega_dm = value

    @omega_dm.deleter
    def omega_dm(self):
        del self._omega_dm

    def __str__(self):
        if self.omega_dm==None:
            raise ValueError("Omega_DM not set")
        else:
            return "Omega_DM = "+str(self.omega_dm)

LCDM=Cosmology()
#print LCDM.omega_dm
#print LCDM
LCDM.omega_dm=0.3
a=LCDM.omega_dm

print LCDM

#LCDM=Cosmology_Decorator()
#LCDM.omega_dm=0.3

#print LCDM

#Crazy_LCDM=Cosmology_Bug(-0.3)

#print Crazy_LCDM

#Crazy_LCDM2=Cosmology()
#Crazy_LCDM2.omega_dm=-.3

#print Crazy_LCDM2
