New submission from Lovi <1668151...@qq.com>:
I think it's appropriate to add the generator fib() to the math module. With fib(), some operations will be easier. The generator is like this: def fib(count=None): if count is not None and not isinstance(count, int): raise ValueError(f"Parameter count has an unexpected type: {count.__class__.__name__}.") a, b = 0, 1 while True: a, b = b, a + b if count is not None: if not count: return count -= 1 yield a ---------- components: Library (Lib) messages: 358375 nosy: lovi priority: normal severity: normal status: open title: Add math.fib() generator type: enhancement versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39043> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com