hwt/code.py
def SwitchLogic(cases, default=None):
    """
    Generate if tree for cases like (syntax shugar for large elifs)

    ..code-block:: python
        if cond0:
            statements0
        elif cond1:
            statements1
        else:
            default

    :param case: iterable of tuples (condition, statements)
    :param default: default statements
    """
    if default is not None:
        assigTop = default
    else:
        assigTop = []

    for cond, statements in reversed(cases):
        assigTop = If(cond,
                      statements
                      ).Else(
            assigTop
        )

    return assigTop
def SwitchLogic(cases, default=None):
    """
    Generate if tree for cases like (syntax shugar for large elifs)

    ..code-block:: python
        if cond0:
            statements0
        elif cond1:
            statements1
        else:
            default

    :param case: iterable of tuples (condition, statements)
    :param default: default statements
    """
    if default is not None:
        assigTop = default
    else:
        assigTop = []

    for cond, statements in reversed(cases):
        assigTop = If(cond,
                      statements
                      ).Else(
            assigTop
        )

    return assigTop
Generate if tree for cases like (syntax shugar for large elifs)

    ..code-block:: python
        if cond0:
            statements0
        elif cond1:
            statements1
        else:
            default

    :param case: iterable of tuples (condition, statements)
    :param default: default statements