Python function to get numbers around another number
Your code seems really complicated, and so you should follow KISS and YAGNI.
max_num and min_num don't work the way I would expect them to.
The error goes against what I think is Pythonic. Just return the smaller set.


def get_numbers_around(number, size):
    return range(number - size, number + size)


If you then need to implement min_num and max_num create a filter:

def filter_between(values, minimum=float('-inf'), maximum=float('inf')):
    return (v for v in values if minimum &lt;= v &lt;= maximum)




&gt;&gt;&gt; get_numbers_around(4, 5)
range(-1, 9)
&gt;&gt;&gt; list(filter_between(_, 0))
[0, 1, 2, 3, 4, 5, 6, 7, 8]