Forum Discussion
andy_12_5042
Nimbostratus
Feb 02, 2011create a method parameter for protocol type
Is there a way I can properly do this below? I am trying to allow the protocol type to be defined in the call itself via a method. However, my lack of Python or in depth programming is killing me with this simple issue. What is the correct way to do this ?
vs_def.protocol = proto + "." + prot_type
TypeError: unsupported operand type(s) for +: 'instance' and 'str'
- andy_12_5042
Nimbostratus
just to be clear, it should look like this : - andy_12_5042
Nimbostratus
It would seem I am thinking about this all wrong. So I decided to do this in a better way and just test the paramter string that I use for protocol and based on the comparison I will set it accordingly. So something like this will work fine and I will have each type defined per the icontrol SDK. I am not a big fan of if statements but since python does not appear to have a "case" as in other languages and this is a small amount of comparisons.... it will do.. This gets away from the trying to concatenate a string with a non-string object, which will not work. Anyway it may not be the best way but it seems to work ok so far.. - andy_12_5042
Nimbostratus
ok yeah that is cleaner way... Awesome thanks for your help!! That saves me from having to do the comparison logic with if statements...
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects