Glauco wrote:

> cache = None
>
> def lookup( domain ):
>     if not cache:
>        cache = dict( [map( lambda x: x.strip(), x.split(':'))  for x in
> open('/etc/virtual/domainowners','r').readlines()])
>     return cache.get(domain)

Neat solution! It just needs small correction for empty or badly
formed lines:

dict([map( lambda x: x.strip(), x.split(':'))  for x in open('/etc/
virtual/domainowners','r') if ':' in x])

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to