Dear Doug:

Working upon the example that Jon had given before I got your email, I found what actually did what I wanted it to be...

namevalues = list(zip(widgets, values))
namevalues = [(w, v) for w, v if v]

for widgetname, widgetvalue in namevalues:

This works exactly as I wanted it to...

Sincerely yours,
Rob G. Healey


On Tue, Aug 16, 2011 at 4:24 AM, Doug Blank <doug.blank@gmail.com> wrote:
On Mon, Aug 15, 2011 at 11:07 PM, Rob Healey <robhealey1@gmail.com> wrote:
> Dear Jerry:
> Is it possible to set the two elements of a dict() separately?
> example:
>  namevalues = dict()
>  namevalues.keys() = [widget for widget in ["Media", "Description",
> "Artist", "Copyright", "Modified", "Original", "Latitude", "Longitude",
> "Altitude"] ]
> namevalues.values() = [value for value in (l1, l2, l3, l4, l5, l6) ]
> or:
> l1, l2, l3, l4, l5, l6 = 1, 2, 3, 4, 5, 6
> widgets = ["MediaTitle", "Description", "Artist", "Copyright", "Latitude",
> "Longitude"]
> values  = [value for value in (l1, l2, l3, l4, l5, l6) ]
> namevalues = [(widget, value) for widget, value in [widgets, values] ]

Rob,

If you already have widgets and values, perhaps the easiest
Python-compatible way is:

dict = {}
for (widget, value) in zip(widgets, values):
  dict[widget] = value

-Doug

> Would you show me the actual python code to accomplish this?
> --
> Sincerely yours,
> Rob G. Healey
> "Always surround yourself with people that inspire you to
> greatness!"
>
> ------------------------------------------------------------------------------
> uberSVN's rich system and user administration capabilities and model
> configuration take the hassle out of deploying and managing Subversion and
> the tools developers use with it. Learn more about uberSVN and get a free
> download at:  http://p.sf.net/sfu/wandisco-dev2dev
>
> _______________________________________________
> Gramps-devel mailing list
> Gramps-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>
>



--
Sincerely yours,
Rob G. Healey

"Always surround yourself with people that inspire you to
greatness!"