Thanks, very much, I was having trouble finding it in Python docs. I didn't 
know what to call it!

-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Emmanuel Blot
Sent: Monday, June 08, 2009 12:04 PM
To: [email protected]
Subject: [Trac] Re: Python question


> Can someone explain this construct to me?
You'd want to look for "list comprehension" documentation in Python

The code snipped can be rewritten as:

errors = []
for field_name in required_fields:
   if self._is_empty(ticket[field_name]):
      errors.append((field_name, '%s is required' % field_name))


>         errors = [(field_name, '%s is required' % field_name)
>                    for field_name in required_fields
>                    if self._is_empty(ticket[field_name])]



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to