summaryrefslogtreecommitdiff
path: root/doc/examples
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-04 07:55:35 +0100
committerGitHub <noreply@github.com>2021-11-04 07:55:35 +0100
commit5a987b8af8dcbddcbd5cade37adebed5b5dd99f1 (patch)
tree51822d76ffe625c0295d28e8f96bbb2749c626eb /doc/examples
parentb99a403704e40a843704ab99582e9acc67be95ed (diff)
downloadpygments-git-5a987b8af8dcbddcbd5cade37adebed5b5dd99f1.tar.gz
Add styles gallery to website (#1943)
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/example.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/examples/example.py b/doc/examples/example.py
new file mode 100644
index 00000000..ae5293af
--- /dev/null
+++ b/doc/examples/example.py
@@ -0,0 +1,14 @@
+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))