Fibonacci generator python implementation I wrote this code for a fibonacci sequence generator. Can anyone tell me whether my code is designed well? if not, why?
import logging

def fibonacci_calc(current_val, current_pos=0, max_seq_length=5, sequence_list=[]):
    try:
        if(current_pos != 0 and len(sequence_list) == 0):
            raise Exception(&quot;Please initalize {} argument: {} with 0&quot;.format(fibonacci_calc.__name__, fibonacci_calc.__code__.co_varnames[1]))
        else:
            if(len(sequence_list) == 0):
                print(&quot;Initialization, added 0 and starting number {} to sequence list&quot;.format(current_val))
                sequence_list.append(0)
                sequence_list.append(current_val)
                current_pos = 1
                print(sequence_list)
                fibonacci_calc(current_val, current_pos, max_seq_length, sequence_list)
            elif(len(sequence_list) == max_seq_length):
                print('{} values in the sequence'.format(max_seq_length))
                return 
            else:
                print(&quot;Current position: {}, Total values: {}  calculating next value&quot;.format(current_pos, current_pos+1))
                next_val = sequence_list[current_pos] + sequence_list[current_pos-1]
                sequence_list.append(next_val)
                print(&quot;Current sequence list {}&quot;.format(sequence_list))
                fibonacci_calc(next_val, current_pos+1, max_seq_length, sequence_list)
    except Exception:
        logging.exception('ERROR')

fibonacci_calc(19,0, 7)
tldr; I'd say that this function is too complicated.
Recursion should be avoided when possible as an iterative method is usually more readable and could be faster. Here's some other things to consider when making a recursive function: https://gist.github.com/abinoda/5593052#when-to-use-recursion-vs-iteration.
I think that some of the naming is not as clear as it could be, although that could just be an effect of the function being recursive. Consider changing parameter max_seq_length to seq_length. I couldn't quite see any scenario where you would give less results than the value passed in to max_seq_length.
Another item that could use some thought is your use of raising an exception when validating your input:
if(current_pos != 0 and len(sequence_list) == 0):
    raise Exception(&quot;Please initalize {} argument: {} with 0&quot;.format(fibonacci_calc.__name__, fibonacci_calc.__code__.co_varnames[1]))

Here, you would likely be better off just logging a message instead of introducing more overhead by using an exception.
Here's an example of a function that addresses my concerns:
def get_fibonacci_sequence(start_num, seq_length):
    if (seq_length &lt; 1):
        return []
    elif (seq_length == 1):
        return [start_num]
    elif (seq_length == 2):
        return [start_num, start_num]

    fibonacci_seq = [start_num, start_num]

    for i in range(2, seq_length):
        fibonacci_seq.append(fibonacci_seq[i - 1] + fibonacci_seq[i - 2])

    return fibonacci_seq

print(get_fibonacci_sequence(19, 7))

PS. I'm assuming all the print statements are just debugging aids and wouldn't be included in the final version. Those messages are likely superfluous for other purposes.