Consider:
{{{#!python
field_names = [
   'first',
   'second',
   'third',
   ]

stuff = [(field_name, 'the field name is \"%s\"' % field_name) for 
field_name in field_names]

print(stuff)

print('\n\n')

more_stuff = dict(stuff)

for key, value in more_stuff.items():
   print(key + ':\t' + value)
}}}

Dan Winslow wrote:
>
> Can someone explain this construct to me?
>
>  
>
>         errors = [(field_name, '%s is required' % field_name)
>
>                    for field_name in required_fields
>
>                    if self._is_empty(ticket[field_name])]
>
>  
>
> What does 'errors' contain? I can see that it's a list of some 
> sort...but the parenthetical grouping in the first line looks like it 
> is some kind of initializer for field_name...so what does it return? 
> The contents of field_name? and how does the for loop work...what's 
> the difference between the if returning false or true?
>
>  
>
> Dan Winslow
> Director of Information Technology, AIM INSTITUTE
> 1905 Harney Street, Suite 700
> Omaha, NE 68102
> 402-345-5025 x156
> [email protected] <mailto:[email protected]>
> www.aiminstitute.org <http://www.aiminstitute.org>
>
>  
>
>
> >

-- 
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Ariel I Balter, Ph.D.
Postdoc
Biological Monitoring/Modeling
Fundamental and Computational Sciences Directorate

Pacific Northwest National Laboratory 
Mail:
PO Box 999, MS P7-58,Richland, WA 99352
Shipping:
790 6th Street, MS P7-58, Richland, WA 99354

Tel:  509-376-7605 
Cell:  509-713-0087
[email protected]
www.arielbalter.com
www.pnl.gov 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

begin:vcard
fn:Ariel Balter, PhD
n:Balter;Ariel
email;internet:[email protected]
tel;home:812-332-2721
tel;cell:812-219-4558
x-mozilla-html:TRUE
url:http://arielbalter.com
version:2.1
end:vcard

Reply via email to