discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Proposal for change of connect arguments


From: Thomas Traber
Subject: [Discuss-gnuradio] Proposal for change of connect arguments
Date: Sun, 6 Feb 2005 12:34:55 +0100
User-agent: Mutt/1.5.5.1+cvs20040105i

Instead of typing

>   connect(src,bandfilter)
>   connect(bandfilter,hilbert)
>   connect(hilbert,real)
>   connect(real,dest)

I would prefer

>   connect(src,bandfilter,hilbert,real,dest)

As I don't know how to handle variable
length arguments in python I tried it
with a list:

>   connect([src,bandfilter,hilbert,real,dest])

Here is the diff for basic_flow_graph.py using an optional list:


---
/org/basic_flow_graph.py
2004-09-10 08:57:06.000000000 +0200
+++ /mod/basic_flow_graph.py
2005-02-06 12:01:20.000000000 +0100
@@ -75,8 +75,15 @@
     __slots__ = ['edge_list']
     def __init__ (self):
         self.edge_list = []
+    
+    def connect (self, points, point2=None):
+        if type(points)==types.ListType:
+            for i in range(1,len(points)):
+                self._connect(points[i-1],points[i])
+        else:
+            self._connect(points,point2)
 
-    def connect (self, src_endpoint, dst_endpoint):
+    def _connect (self, src_endpoint, dst_endpoint):
         src_endpoint = coerce_endpoint (src_endpoint)
         dst_endpoint = coerce_endpoint (dst_endpoint)
         self._check_valid_src_port (src_endpoint)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]