i did this because this will read colors into a nested variable How would i make this work the way you suggest? I already have it working now :)
Not able to set to dict value with setattr, how to do this too(sorry if off subject)? I can set it like this: for i in self.opt['properties'].keys(): self.opt[i] = getattr(self.opt['properties_object'], i) but not like this: for i in self.opt['properties'].keys(): setattr(self, opt[i], getattr(self.opt['properties_object'], i)) -Alex Goretoy http://www.goretoy.com On Sun, Mar 15, 2009 at 6:41 PM, MRAB <goo...@mrabarnett.plus.com> wrote: > alex goretoy wrote: > >> ok now for the final result, i decided to split options out to a separate >> dict of lists, does this look right to every one, I currently have error >> somewhere else in my code so can't test this right now, Is this a good >> method to do this? or is there another option? >> >> [snip] > First of all, *don't use "is" and "is not" to test for equality*; use "==" > and "!=". > > When you split the options out like that you get duplication. > > You have, for example: > > ... > "colors": ["c", "cl", "col", ...] > ... > > and: > > ... > "imp_colors": ["c", "cl", "col", ...] > ... > > Couldn't you put them into one dict, something like: > > ... > "colors": ("imp_colors", ["c", "cl", "col", ...]) > ... > > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list