You could invert your if-expressions, e.g. instead of
if query_company_name:
...
you could write
if not query_company_name:
return adresses, company
...
This way you could save some indentation.
If you want to get rid of the for loops, you could look at list
comprehensions, e.g.
cmps = [ressource.get_resource(item, soft=True) for item in companies]
- Patrick
Norman Khine wrote:
On Thu, Sep 24, 2009 at 10:25 PM, Kent Johnson <ken...@tds.net> wrote:
On Thu, Sep 24, 2009 at 2:12 PM, Norman Khine <nor...@khine.net> wrote:
Hello,
I have this function in my class:
http://paste.lisp.org/display/87659
Is there a better method to write the last bit of the code.
Better in what way? What are these things? What is resource? Some
context would be helpful, I seem to have misplaced my mindreader hat.
Apologies for not being clear. I was thinking more that I may have
one the too many 'for' loops at the end of the code.
Here is a new version with more details.
http://paste.lisp.org/display/87659#1
Thanks
Kent
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor