Dynamic method parameter access?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dennis Kempin

    Dynamic method parameter access?

    Hello,

    I have a set of some objects. With these objects I want to call a Python
    method. But the writer of the method shall have the option to select
    from these objects as method parameter.

    At the moment i use the following way to call a method with the a or b
    or both parameter.

    try:
    method(a=value)
    except TypeError:
    try:
    method(b=value)
    except TypeError:
    method(a=value, b=value)

    This is getting really complex the more optional parameters I want to
    provide.
    Is there any other way to access the method parameter?

    Thanks in advance,
    Dennis

Working...