This repository has been archived on 2024-06-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
coffee.pygments/doc/examples/example.py
Martin Fischer 61fd608b92 styles gallery: Make docstring in example follow PEP 257
The example is displayed multiple times at https://pygments.org/styles/.
Code displayed on the Pygments website should follow best practices,
such as https://peps.python.org/pep-0257/.
2022-12-30 10:35:14 +01:00

14 lines
316 B
Python

from typing import Iterator
# This is an example
class Math:
@staticmethod
def fib(n: int) -> Iterator[int]:
"""Fibonacci series up to n."""
a, b = 0, 1
while a < n:
yield a
a, b = b, a + b
result = sum(Math.fib(42))
print("The answer is {}".format(result))