[IPython-dev] Small config puzzle

Min RK benjaminrk at gmail.com
Sun Jun 3 16:37:38 EDT 2012


On Jun 3, 2012, at 1:11 PM, Fernando Perez <fperez.net at gmail.com> wrote:

> On Sun, Jun 3, 2012 at 12:00 PM, MinRK <benjaminrk at gmail.com> wrote:
>> The Config file has no idea that rc is a dict (or that rc is an option at
>> all).
>> The only thing you can do in config files is assignment:
>> c.InlineBackend.rc = {'savefig.dpi': 96}
>> Traitlets are not involved at all in the config files or the construction of
>> the config object, they determine how the config object (after it is
>> constructed by config files and command-line opts) is interpreted.
> Ah, understood.  Then the next question is: will the default rc object
> be overridden or updated with these values?

Overridden. The only thing you can do in config is simple attribute assignment. It doesn't do anything fancy, so c.InlineBackend.rc = foo is the same as doing the actual assignment to the real object.

I don't know if you recall, but we discussed an API in your office to address this sort of thing for container traits, where we had an idea like:

c.InlineBackend._rc_update = dict(foo=bar)

for dicts or 

c.Foo._bar_extend = [more, entries]

for lists. 

> Cheers,
> f
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

More information about the IPython-dev mailing list