global name not defined

bruno at modulix onurb at xiludom.gro
Tue May 23 10:14:41 CEST 2006


NetKev wrote:
(snip)
>     def process_log(self, logfile, offset):
>         if new_denied_hosts:
>             info("new denied hosts: %s", str(new_denied_hosts))
>             [warn_Admin(ip) for ip in new_denied_hosts]

This uselessly builds a list. List comprehension is meant to create
lists, not to replace for loops.

              for ip in new_denied_hosts:
                  warn_admin(ip)


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list