you could assign loop variable<br><br>   @staticmethod<br>
    def get_form(address=None, postcode=None, town=None, phone=None, fax=None,<br>
                 freephone=None, address_country=None, address_region=None,<br>
                 address_county=None, hotel=None):<br>
        context = get_context()<br>
        root = context.root<br>
        # List authorized countries<br><br>       loopvar = root.get_active_countries(context) if hotel else root.get_authorized_countries(context)<br><br>
         countries = [ {&#39;name&#39;: y, &#39;title&#39;: x, &#39;selected&#39;: y == address_country} for x, y in loopvar ]<br> 
 <br>
<br><br><br><div class="gmail_quote">On Thu, Jun 4, 2009 at 11:25 AM, Norman Khine <span dir="ltr">&lt;<a href="mailto:norman@khine.net">norman@khine.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
Is there a better way to write this:<br>
<br>
    @staticmethod<br>
    def get_form(address=None, postcode=None, town=None, phone=None, fax=None,<br>
                 freephone=None, address_country=None, address_region=None,<br>
                 address_county=None, hotel=None):<br>
        context = get_context()<br>
        root = context.root<br>
        # List authorized countries<br>
        if hotel is True:<br>
            countries = [<br>
                {&#39;name&#39;: y, &#39;title&#39;: x, &#39;selected&#39;: y == address_country}<br>
                for x, y in root.get_active_countries(context) ]<br>
        else:<br>
            countries = [<br>
                {&#39;name&#39;: y, &#39;title&#39;: x, &#39;selected&#39;: y == address_country}<br>
                for x, y in root.get_authorized_countries(context) ]<br>
<br>
Thanks<br>
_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</blockquote></div><br>