On 01/05/2012 05:58 PM, Benjamin Root wrote: > > > On Thu, Jan 5, 2012 at 10:40 AM, Benjamin Root <ben.r...@ou.edu > <mailto:ben.r...@ou.edu>> wrote: > > > At the very least, it would help in compartmentallizing all the > possible > drawing attributes that are common across all artists. Currently, I > am > envisioning using a defaultdict object (which was introduced in python > 2.5) or subclassing from it. This might help in keeping compatibility > with existing code. Subclassing would allow for modifying __get__ and > __set__ to treat some elements like 'c' and 'color', 'lw' and > 'linewidth' and so on as the same. > > > Grrrr, in defaultdict(), the default_factory is called without arguments, so a > factory can't be made to produce a default value for a given key, unless I > resort to more hackary...
FWIW, defaultdict() only uses the __missing__ dictionary hook, and that one is passed the key. It's easy to implement a similar class that calls the factory with a key argument. Georg ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users