Skip to content

Commit 9b65133

Browse files
committed
docs: constistent docs across repos.
1 parent 55ddbe9 commit 9b65133

5 files changed

Lines changed: 156 additions & 36 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,6 @@ cython_debug/
160160
#.idea/
161161

162162
.DS_Store
163-
.vscode
163+
.vscode
164+
165+
tools/

.spellcheck_exceptions_dictionary.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ DEDENT
77
REPL
88
BNF
99
UTF
10-
10+
MYINC
1111

1212
# authors
1313
Rossum

README.md

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,55 @@
11
# Python
22

33
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
4-
![build status](https://github.com/praisetompane-programming-languages/python/actions/workflows/python.yaml/badge.svg) <br>
5-
6-
**objective**: An in-depth study of:
7-
- Python's Interpreter:
8-
- This focuses on [CPython](https://github.com/python/cpython).
9-
- Python's language design, implementation and ecosystem.
10-
11-
## Language Details:
12-
- [language reference](https://docs.python.org/3.11/reference/index.html#reference*index)
13-
- [interpreter:](https://github.com/python/cpython)
14-
- [Bennett, J. 2019. See CPython run: Getting to know your Python interpreter. North Bay Python](https://www.youtube.com/watch?v=tzYhv61piNY)
15-
- [base modules index](https://docs.python.org/3/py-modindex.html)
16-
- [standard library reference](https://docs.python.org/3.11/library/index.html)
17-
- [packaging and distribution](https://packaging.python.org/en/latest/)
18-
- [python packaging authority](https://www.pypa.io/en/latest/)
19-
- [glossary](https://packaging.python.org/en/latest/glossary/)
20-
- tools:
21-
- [pip](https://pypi.org/project/pip/)
22-
- [pipenv](https://pipenv.pypa.io/en/latest/)
23-
- structuring projects:
24-
- [package index](https://pypi.org)
25-
- [extending and embedding](https://docs.python.org/3.11/extending/index.html)
26-
- [developer contribution guide](https://devguide.python.org/)
27-
- memory model:
28-
- [computational complexity cost model](https://ocw.mit.edu/courses/6-006-introduction-to-algorithms-fall-2011/pages/readings/python-cost-model/)
29-
- history:
30-
- [The Story of Python, by Its Creator, Guido van Rossum](https://www.youtube.com/watch?v=J0Aq44Pze-w)
31-
32-
## Testing:
4+
![build status](https://github.com/praisetompane/python/actions/workflows/python.yaml/badge.svg) <br>
5+
6+
## Objectives
7+
- An in-depth study of Python's:
8+
- Interpreter.
9+
- This focuses on [CPython](https://github.com/python/cpython).
10+
- Python's design, implementation and ecosystem.
11+
12+
## Language Details
13+
- [language reference](https://docs.python.org/3.11/reference/index.html#reference*index)
14+
- [interpreter:](https://github.com/python/cpython)
15+
- [Bennett, J. 2019. See CPython run: Getting to know your Python interpreter. North Bay Python](https://www.youtube.com/watch?v=tzYhv61piNY)
16+
- [base modules index](https://docs.python.org/3/py-modindex.html)
17+
- [standard library reference](https://docs.python.org/3.11/library/index.html)
18+
- [packaging and distribution](https://packaging.python.org/en/latest/)
19+
- [python packaging authority](https://www.pypa.io/en/latest/)
20+
- [glossary](https://packaging.python.org/en/latest/glossary/)
21+
- tools:
22+
- [pip](https://pypi.org/project/pip/)
23+
- [pipenv](https://pipenv.pypa.io/en/latest/)
24+
- structuring projects:
25+
- [package index](https://pypi.org)
26+
- [extending and embedding](https://docs.python.org/3.11/extending/index.html)
27+
- [developer contribution guide](https://devguide.python.org/)
28+
- memory model:
29+
- [computational complexity cost model](https://ocw.mit.edu/courses/6-006-introduction-to-algorithms-fall-2011/pages/readings/python-cost-model/)
30+
- history:
31+
- [The Story of Python, by Its Creator, Guido van Rossum](https://www.youtube.com/watch?v=J0Aq44Pze-w)
32+
33+
## Testing
3334
- [pytest](https://docs.pytest.org/en/latest/index.html#)
3435

35-
## Use Cases:
36-
- [Applications for Python](https://www.python.org/about/apps/)
36+
## Use Cases
37+
- [Applications of Python](https://www.python.org/about/apps/)
3738

38-
## Learning Resources:
39+
## Learning Resources
3940
- [roadmap](https://roadmap.sh/python)
4041
- [practice problems](https://www.hackerrank.com/domains/python?filters%5Bstatus%5D%5B%5D=unsolved&badge_type=python)
4142

42-
## Spell Check:
43-
43+
## Spell Check
4444
```shell
4545
pyspelling -c spellcheck.yaml
4646
```
4747

4848
# References:
4949

50+
## Legend:
51+
**Q**: Question for later research
52+
53+
**MYINC**: My Insight/Conjecture [Could Be Unoriginal/False and Likely Is]
54+
5055
**Disclaimer**: This is an ongoing and incomplete project to unpack these concepts and serve as my distributed memory.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
"""
2+
def iterator:
3+
- formal:
4+
- in words: an object that represents a stream of data.
5+
6+
- properties:
7+
- forward and reserve traversal.
8+
- can only be traversed once.
9+
- plain english: ???
10+
11+
- intuition: ???
12+
13+
- properties: ???
14+
15+
- examples: ???
16+
17+
- use cases: ???
18+
19+
- proof: None. It is a definition.
20+
21+
References:
22+
PEP 234 – Iterators. https://peps.python.org/pep-0234/
23+
"""
24+
25+
collection = [i for i in range(5)]
26+
27+
print("Forward Iteration with next(forward_iterator)")
28+
forward_iterator = iter(collection)
29+
print(f"Type: {type(forward_iterator)}")
30+
print(f"Print next element {next(forward_iterator)}")
31+
print(f"Print next element {next(forward_iterator)}")
32+
print(f"Print next element {next(forward_iterator)}")
33+
print(f"Print next element {next(forward_iterator)}")
34+
print(f"Print next element {next(forward_iterator)}")
35+
# print(f"Print next element {next(forward_iterator)}")
36+
print("\n")
37+
38+
print("Forward Iteration with __next__")
39+
forward_iterator_2 = iter(collection)
40+
print(f"Print next element {forward_iterator_2.__next__()}")
41+
print(f"Print next element {forward_iterator_2.__next__()}")
42+
print(f"Print next element {forward_iterator_2.__next__()}")
43+
print(f"Print next element {forward_iterator_2.__next__()}")
44+
print(f"Print next element {forward_iterator_2.__next__()}")
45+
# print(f"Print next element {forward_iterator)}")
46+
print("\n")
47+
48+
print("Reverse Iteration")
49+
reverse_iterator = reversed(collection)
50+
print(f"Type: {type(forward_iterator)}")
51+
print(f"Print next element {next(reverse_iterator)}")
52+
print(f"Print next element {next(reverse_iterator)}")
53+
print(f"Print next element {next(reverse_iterator)}")
54+
print(f"Print next element {next(reverse_iterator)}")
55+
print(f"Print next element {next(reverse_iterator)}")
56+
# print(f"Print next element {next(reverse_iterator)}")
57+
print("\n")
58+
59+
# Single Travel Example
60+
collection = [i for i in range(5)]
61+
iterator = iter(collection)
62+
63+
print("First pass of the iterator")
64+
for v in iterator:
65+
print(v)
66+
67+
# This next pass will fail, because we have exhausted the iterator's single pass
68+
print("Second pass of the iterator")
69+
for v in iterator:
70+
print(v)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""
2+
def generator | generator function:
3+
- formal: 𝑓: any ↦ Generator Iterator
4+
- in words: a function that creates and returns a Generator Iterator.
5+
6+
- plain english: ???
7+
8+
- intuition: ???
9+
10+
- properties: ???
11+
12+
- examples:
13+
- useful example: src/applications/math/fibonacci.py
14+
15+
- use cases: ???
16+
17+
- proof: None. It is a definition.
18+
19+
References:
20+
PEP 255 – Simple Generators. https://www.python.org/dev/peps/pep-0255/#motivation
21+
22+
"""
23+
24+
25+
def generate_infinite_numbers():
26+
"""
27+
Generate infinite numbers
28+
"""
29+
number = 0
30+
while True:
31+
yield number
32+
number += 1
33+
34+
35+
def generator_expression():
36+
sum(i * i for i in range(10))
37+
38+
39+
if __name__ == "__main__":
40+
for number in generate_infinite_numbers():
41+
print(number)
42+
43+
# print(generator_expression())

0 commit comments

Comments
 (0)