errors contains a list of tuppes, each with two elements.  The first 
element in each tupple is a string, the "field_name", and a second is 
the string that gets manufactured with %s is required' % field_name 
based on the value of "field_name".

I'm guessing that the next thing is that the list errors will get 
"zipped" into a dictionary.  There is actually a way to make 
dictionaries with those kinds of expressions, but I don't remember the 
syntax off the top of my head.

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