[ovs-dev,14/55] python: Stop use of tuple parameter unpacking
diff mbox

Message ID 1450730875-18083-15-git-send-email-russell@ovn.org
State Deferred
Headers show

Commit Message

Russell Bryant Dec. 21, 2015, 8:47 p.m. UTC
Python 3 removed support for tuple parameter unpacking.

https://www.python.org/dev/peps/pep-3113/

Instead of:

    def foo((a, b)):
        print(a)
        print(b)

you should do:

    def foo(a_b):
        a, b = a_b
        print(a)
        print(b)

but in both uses here, the values were never used so the fix is even
simpler.

Signed-off-by: Russell Bryant <russell@ovn.org>
---
 python/ovstest/udp.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox

diff --git a/python/ovstest/udp.py b/python/ovstest/udp.py
index d6e6162..acd28d5 100644
--- a/python/ovstest/udp.py
+++ b/python/ovstest/udp.py
@@ -31,7 +31,7 @@  class UdpListener(DatagramProtocol):
     def __init__(self):
         self.stats = []
 
-    def datagramReceived(self, data, (_1, _2)):
+    def datagramReceived(self, data, _1_2):
         """This function is called each time datagram is received"""
         try:
             self.stats.append(struct.unpack_from("Q", data, 0))
@@ -67,7 +67,7 @@  class UdpSender(DatagramProtocol):
             self.looper.stop()
             self.looper = None
 
-    def datagramReceived(self, data, (host, port)):
+    def datagramReceived(self, data, host_port):
         pass
 
     def sendData(self):