[ovs-dev] [RFC] ovs-tcpdump: Add a tcpdump wrapper utility

Flavio Leitner fbl at sysclose.org
Wed May 25 22:31:14 UTC 2016


On Wed, May 25, 2016 at 11:08:37AM -0400, Aaron Conole wrote:
> Flavio Leitner <fbl at sysclose.org> writes:
> > On Tue, May 24, 2016 at 04:35:29PM -0400, Aaron Conole wrote:
[...] 
> >> +
> >> +    ovsdb = OVSDB(db_sock)
> >> +    if mirror_interface is None:
> >
> > mirror_interface is referenced but it hasn't been initialized.
> 
> Python :-)  Technically, it's allowed, and flake8 or pyflakes doesn't
> complain (because it is perfectly valid python).  However, I can
> rewrite it something like
> 
> mirror_interface = None
> ...
> mirror_interface = mirror_interface or "mi_%s" % interface
> 
> if you think that feels more natural. Doesn't matter to me.

I tried something simple:

   >>> def func():
   ...     if NotDeclared:
   ...             pass
   ... 
   >>> func()
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "<stdin>", line 2, in func
   NameError: global name 'NotDeclared' is not defined
   
and it complains. :-)
[Python 2.7.11]

-- 
fbl




More information about the dev mailing list