[New-bugs-announce] [issue39043] Add math.fib() generator
Lovi
report at bugs.python.org
Fri Dec 13 23:43:56 EST 2019
New submission from Lovi <1668151593 at 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 <report at bugs.python.org>
<https://bugs.python.org/issue39043>
_______________________________________
More information about the New-bugs-announce
mailing list