I've been thinking a bit about rcParams and validation. It looks like values 
are currently only validated when matplolibrc is read, during the call to 
rc_params. What if we define a new class (RcParams), derived from dict, which 
has as an attribute, a dict, called validate. We could override __setitem__ 
such that

rcParams['font.size'] = 12

validates the value 12 by first calling validate_float, which is referenced in 
the validate attribute:

    def __setitem__(self, i='font.size', val=12)
        try:
            self.validate[i](val)
            dict.__setitem__(self, i, val)
        except KeyError:
            raise (or warning), bad value

the validation dict and default properties would be populated during the 
initial call to rc_params(), when the defaultParams dict is interpretted. 
Thereafter, any attempt to set a parameter, either directly using 
rcParams[i]=j or indirectly using rc(), will benefit from validation. The 
behavior would otherwise be unchanged, I think. Any comments or objections?

Darren

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to