nengo-1.4
nengo-1.4 copied to clipboard
If we give the name of an existing termination in net.connect it should use the existing termination
Right now if you give the name of an existing termination, it'll create a new termination rather than using the existing one. The only way to use an existing termination is to pass the termination itself.
Right now its required for scriptgen for terminations onto templates to work. It can be changed so scriptgen will try and keep track of existing terminations from templates but it'll be messy and I think it should be handled in the connect function as its much easier.
Excellent idea. I think the main question would be what the syntax for this would be. Here's some options that come to mind for the general case of connecting an existing origin to an existing termination:
net.connect('A','B',origin='X',termination='input') # explicit labels net.connect('A:X','B:input') # using ':' as a separator for origins/terminations net.connect('A.X','B.input') # using '.' as a separator (even though it's already used for subnetworks) net.connect(('A','X'),('B','input')) # yuck
Any other ideas?
I kind of like the ':' notation myself.
I'll take a stab at supporting both of the first two approaches.