From f665ffc56c768464fac8c1bd8644dd4fb5c3674f Mon Sep 17 00:00:00 2001 From: Praise Tompane Date: Sun, 23 Mar 2025 12:03:25 +0200 Subject: [PATCH 1/2] docs: object definition. clean up setup. pin to latest python. --- .tool-versions | 2 +- 1_core_language/3_datamodel/0_datamodel.txt | 25 +++++++++++++++ 1_core_language/3_datamodel/0_def.txt | 24 -------------- .../1_objects_values_and_types/0_objects.txt | 32 +++++++++++++++++++ .../1_objects_values_and_types/def.txt | 28 ---------------- .../{0_def.txt => 0_standard_library.txt} | 0 .../{0_def.xt => 0_built_in_types.xt} | 9 +++++- .../1_type_annotation_types.txt | 2 +- Dockerfile | 2 +- setup.sh | 13 ++++++-- 10 files changed, 79 insertions(+), 58 deletions(-) create mode 100644 1_core_language/3_datamodel/0_datamodel.txt delete mode 100644 1_core_language/3_datamodel/0_def.txt create mode 100644 1_core_language/3_datamodel/1_objects_values_and_types/0_objects.txt delete mode 100644 1_core_language/3_datamodel/1_objects_values_and_types/def.txt rename 2_standard_library/{0_def.txt => 0_standard_library.txt} (100%) rename 2_standard_library/4_built_in_types/{0_def.xt => 0_built_in_types.xt} (54%) diff --git a/.tool-versions b/.tool-versions index 88b5912..3c35347 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -python 3.12.3 \ No newline at end of file +python 3.13.2 diff --git a/1_core_language/3_datamodel/0_datamodel.txt b/1_core_language/3_datamodel/0_datamodel.txt new file mode 100644 index 0000000..2e9aabd --- /dev/null +++ b/1_core_language/3_datamodel/0_datamodel.txt @@ -0,0 +1,25 @@ +def datamodel: + - formal: ??? + + - in words: ??? + + - plain english: ??? + + - intuition: ??? + + - properties: ??? + + - examples: ??? + + - use cases: + - a means by which we can implement protocols(Powell, 2017) + the protocol meaning is determined by the specific type. + example: + - __add__ for a string means concatenate + - __add__ for a Polynomial means add the coefficients + - ... + + - proof: ??? + +References: + Powell, J. 2017. What Does It Take To Be An Expert At Python. PyData \ No newline at end of file diff --git a/1_core_language/3_datamodel/0_def.txt b/1_core_language/3_datamodel/0_def.txt deleted file mode 100644 index 6c5753a..0000000 --- a/1_core_language/3_datamodel/0_def.txt +++ /dev/null @@ -1,24 +0,0 @@ -What is the Data model? - -1. objects, values and types - What is?: - id() - type() - -2. the standard type hierarchy - Is there a picture of the Standard Type Hierarchy? - - - Are values immutable in Python? - some sequences: - - strings - - tuples - - bytes - - Mutable ones: - - list - - byte array - -3. special method names - -4. coroutines \ No newline at end of file diff --git a/1_core_language/3_datamodel/1_objects_values_and_types/0_objects.txt b/1_core_language/3_datamodel/1_objects_values_and_types/0_objects.txt new file mode 100644 index 0000000..06a29da --- /dev/null +++ b/1_core_language/3_datamodel/1_objects_values_and_types/0_objects.txt @@ -0,0 +1,32 @@ +def object: + - formal: ??? + - in words: ??? + + - plain english: Python's abstraction for data and code. + + - intuition: ??? + + - properties: + - id + - value + - type + - implementation: + - cpython: + - PyTypeObject + - type system: https://typing.python.org/en/latest/spec/index.html + + - operations: + - is: compares object identity + - id(object): returns an object's identity memory address(in cpython) + + - implementation: + - cpython: + - id(object) = memory address + - examples: ??? + + - use cases: ??? + + - proof: ??? + +References: ??? + Python Software Foundation. 2023. Objects, values and types. https://docs.python.org/3.12/reference/datamodel.html#objects-values-and-types \ No newline at end of file diff --git a/1_core_language/3_datamodel/1_objects_values_and_types/def.txt b/1_core_language/3_datamodel/1_objects_values_and_types/def.txt deleted file mode 100644 index 2c73023..0000000 --- a/1_core_language/3_datamodel/1_objects_values_and_types/def.txt +++ /dev/null @@ -1,28 +0,0 @@ -What is the Data model? - -def data model: - a means by which we can implement protocols. - the protocol meaning is determined by the specific type. - example: - - __add__ for a string means concatenate - - __add__ for a Polynomial means add the coefficients - - ... - -1. objects, values and types - What is?: - id() - type() - - -2. values: - - -3. types: - C/Python API for defining types: https://docs.python.org/3.11/c-api/typeobj.html#c.PyTypeObject.tp_iter - - key structures: - - PyTypeObject - - - The Python Type System: https://typing.python.org/en/latest/spec/index.html - -References: - Python Software Foundation. 2023. Objects, values and types. https://docs.python.org/3.12/reference/datamodel.html#objects-values-and-types \ No newline at end of file diff --git a/2_standard_library/0_def.txt b/2_standard_library/0_standard_library.txt similarity index 100% rename from 2_standard_library/0_def.txt rename to 2_standard_library/0_standard_library.txt diff --git a/2_standard_library/4_built_in_types/0_def.xt b/2_standard_library/4_built_in_types/0_built_in_types.xt similarity index 54% rename from 2_standard_library/4_built_in_types/0_def.xt rename to 2_standard_library/4_built_in_types/0_built_in_types.xt index 1b11ee5..0b63fe5 100644 --- a/2_standard_library/4_built_in_types/0_def.xt +++ b/2_standard_library/4_built_in_types/0_built_in_types.xt @@ -8,6 +8,13 @@ def built-in types: - intuition: ??? - properties: + - principle types: + - numerics + - sequences + - mappings + - classes + - instances + - exceptions - all built-in type names in the STL https://docs.python.org/3/library/types.html#module-types - examples: ??? @@ -17,4 +24,4 @@ def built-in types: - proof: ??? References: ??? - + The Python Standard Library. Built-in Types. https://docs.python.org/3/library/stdtypes.html diff --git a/2_standard_library/4_built_in_types/13_type_annotation_types/1_type_annotation_types.txt b/2_standard_library/4_built_in_types/13_type_annotation_types/1_type_annotation_types.txt index dae832e..5fb31a8 100644 --- a/2_standard_library/4_built_in_types/13_type_annotation_types/1_type_annotation_types.txt +++ b/2_standard_library/4_built_in_types/13_type_annotation_types/1_type_annotation_types.txt @@ -23,4 +23,4 @@ def type_annotation_types - proof: ??? References: - - The Python Standard Library. 2025. Type Annotation Types. https://docs.python.org/3/library/stdtypes.html#type-annotation-types-generic-alias-union + The Python Standard Library. 2025. Type Annotation Types. https://docs.python.org/3/library/stdtypes.html#type-annotation-types-generic-alias-union diff --git a/Dockerfile b/Dockerfile index 3759ba5..498fdf2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/python:3 +FROM python:3.13 WORKDIR /python diff --git a/setup.sh b/setup.sh index 12736a6..34f8f4f 100755 --- a/setup.sh +++ b/setup.sh @@ -1,3 +1,4 @@ +VERSION="3.13.2" echo "Adding asdf python plugin" asdf plugin add python echo "Done" @@ -10,9 +11,17 @@ if [ "$ostype" = "Linux" ]; then fi echo "Installing python" - asdf install python latest + asdf install python $VERSION echo "Done" echo "Set python version" - asdf set python latest + asdf set python $VERSION +echo "Done" + +echo "Install pipenv" + pip install pipenv --user +echo "Done" + +echo "Adding user binaries to system path" + echo 'export PATH="$PATH:~/.local/bin"' >> ~/.zshrc echo "Done" \ No newline at end of file From bc1d9b1cc359cd3d1bb0a88a701be39ee9c57e09 Mon Sep 17 00:00:00 2001 From: Praise Tompane Date: Sun, 23 Mar 2025 13:41:20 +0200 Subject: [PATCH 2/2] docs: clean up high level language components --- .spellcheck_exceptions_dictionary.txt | 2 +- .../0_data_model.txt} | 2 +- .../1_objects_values_and_types/0_objects.txt | 0 .../2_the_standard_type_hierarchy/def.py | 0 .../2_the_standard_type_hierarchy/def.txt | 0 .../3_special_method_names/def.txt | 0 .../4_coroutines/def.txt | 0 .../4_built_in_types/0_built_in_types.xt | 2 +- README.md | 58 ++++++++++--------- spellcheck.yaml | 2 +- 10 files changed, 34 insertions(+), 32 deletions(-) rename 1_core_language/{3_datamodel/0_datamodel.txt => 3_data_model/0_data_model.txt} (97%) rename 1_core_language/{3_datamodel => 3_data_model}/1_objects_values_and_types/0_objects.txt (100%) rename 1_core_language/{3_datamodel => 3_data_model}/2_the_standard_type_hierarchy/def.py (100%) rename 1_core_language/{3_datamodel => 3_data_model}/2_the_standard_type_hierarchy/def.txt (100%) rename 1_core_language/{3_datamodel => 3_data_model}/3_special_method_names/def.txt (100%) rename 1_core_language/{3_datamodel => 3_data_model}/4_coroutines/def.txt (100%) diff --git a/.spellcheck_exceptions_dictionary.txt b/.spellcheck_exceptions_dictionary.txt index 8afb3f4..ceeceab 100644 --- a/.spellcheck_exceptions_dictionary.txt +++ b/.spellcheck_exceptions_dictionary.txt @@ -40,7 +40,6 @@ pycache IndentationError TabError SyntaxError -datamodel coroutines lexemes lexically @@ -138,6 +137,7 @@ PyData # urls: +datamodel pkgs readthedocs src diff --git a/1_core_language/3_datamodel/0_datamodel.txt b/1_core_language/3_data_model/0_data_model.txt similarity index 97% rename from 1_core_language/3_datamodel/0_datamodel.txt rename to 1_core_language/3_data_model/0_data_model.txt index 2e9aabd..43db780 100644 --- a/1_core_language/3_datamodel/0_datamodel.txt +++ b/1_core_language/3_data_model/0_data_model.txt @@ -1,4 +1,4 @@ -def datamodel: +def data model: - formal: ??? - in words: ??? diff --git a/1_core_language/3_datamodel/1_objects_values_and_types/0_objects.txt b/1_core_language/3_data_model/1_objects_values_and_types/0_objects.txt similarity index 100% rename from 1_core_language/3_datamodel/1_objects_values_and_types/0_objects.txt rename to 1_core_language/3_data_model/1_objects_values_and_types/0_objects.txt diff --git a/1_core_language/3_datamodel/2_the_standard_type_hierarchy/def.py b/1_core_language/3_data_model/2_the_standard_type_hierarchy/def.py similarity index 100% rename from 1_core_language/3_datamodel/2_the_standard_type_hierarchy/def.py rename to 1_core_language/3_data_model/2_the_standard_type_hierarchy/def.py diff --git a/1_core_language/3_datamodel/2_the_standard_type_hierarchy/def.txt b/1_core_language/3_data_model/2_the_standard_type_hierarchy/def.txt similarity index 100% rename from 1_core_language/3_datamodel/2_the_standard_type_hierarchy/def.txt rename to 1_core_language/3_data_model/2_the_standard_type_hierarchy/def.txt diff --git a/1_core_language/3_datamodel/3_special_method_names/def.txt b/1_core_language/3_data_model/3_special_method_names/def.txt similarity index 100% rename from 1_core_language/3_datamodel/3_special_method_names/def.txt rename to 1_core_language/3_data_model/3_special_method_names/def.txt diff --git a/1_core_language/3_datamodel/4_coroutines/def.txt b/1_core_language/3_data_model/4_coroutines/def.txt similarity index 100% rename from 1_core_language/3_datamodel/4_coroutines/def.txt rename to 1_core_language/3_data_model/4_coroutines/def.txt diff --git a/2_standard_library/4_built_in_types/0_built_in_types.xt b/2_standard_library/4_built_in_types/0_built_in_types.xt index 0b63fe5..b21b093 100644 --- a/2_standard_library/4_built_in_types/0_built_in_types.xt +++ b/2_standard_library/4_built_in_types/0_built_in_types.xt @@ -23,5 +23,5 @@ def built-in types: - proof: ??? -References: ??? +References: The Python Standard Library. Built-in Types. https://docs.python.org/3/library/stdtypes.html diff --git a/README.md b/README.md index 72318cd..7a43377 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,48 @@ # Python -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) ![build status](https://github.com/praisetompane/python/actions/workflows/python.yaml/badge.svg)
## Objectives - An in-depth study of Python's: - - Interpreter. - - This focuses on [CPython](https://github.com/python/cpython). - - [CPython Source Code Layout](https://devguide.python.org/internals/exploring/) - - [Annotations on the actual interpreter implementation](https://github.com/praisetompane/python_implementation_study_cpython) - - They are prefixed with "Praise:" - - Python's design, implementation and ecosystem. + - Interpreter. + - This focuses on [CPython](https://github.com/python/cpython). + - [CPython Source Code Layout](https://devguide.python.org/internals/exploring/) + - [Style Guide](https://peps.python.org/pep-0008/) + - [Python](https://peps.python.org/pep-0007/) + - [C](https://peps.python.org/pep-0007/) + - [Annotations on the actual interpreter implementation](https://github.com/praisetompane/python_implementation_study_cpython) + - They are prefixed with "Praise:" + - Python's design, implementation and ecosystem. ## Language Details +- Language Specification: None +- [Compiler | Interpreter](https://github.com/python/cpython) + - [Bennett, J. 2019. See CPython run: Getting to know your Python interpreter. North Bay Python](https://www.youtube.com/watch?v=tzYhv61piNY) +- [Type System](https://typing.python.org/en/latest/spec/index.html) +- [Memory Model](https://ocw.mit.edu/courses/6-006-introduction-to-algorithms-fall-2011/pages/readings/python-cost-model/) - [Language Reference](https://docs.python.org/3/reference/index.html) -- [Interpreter](https://github.com/python/cpython) - - [Bennett, J. 2019. See CPython run: Getting to know your Python interpreter. North Bay Python](https://www.youtube.com/watch?v=tzYhv61piNY) -- [Modules Index](https://docs.python.org/3/py-modindex.html) -- Memory Model: - - [Computational Complexity Cost Model](https://ocw.mit.edu/courses/6-006-introduction-to-algorithms-fall-2011/pages/readings/python-cost-model/) - [Standard Library](https://docs.python.org/3/library/index.html) -- [Packaging and Distribution](https://packaging.python.org/en/latest/) - - [Package Index](https://pypi.org) - - [Python Packaging Authority](https://www.pypa.io/en/latest/) - - [The Hitchhiker’s Guide to Packaging](https://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/) - - [Glossary](https://packaging.python.org/en/latest/glossary/) - - Tools: - - [pip](https://pip.pypa.io/en/stable/) - - [pipenv](https://pipenv.pypa.io/en/latest/) - - Structuring Projects - - ... +- [Packaging and Distribution]( https://www.pypa.io/en/latest/) + - [Core Module Index](https://docs.python.org/3/py-modindex.html) + - [Package Index](https://pypi.org) + - Tools: + - [pip](https://pip.pypa.io/en/stable/) + - [pipenv](https://pipenv.pypa.io/en/latest/) + - Structuring Projects: + - ... - [Extending and Embedding](https://docs.python.org/3/extending/index.html) - - [PEP Index](https://www.python.org/dev/peps/) + - [PEP Index](https://www.python.org/dev/peps/) - [Developer Contribution Guide](https://devguide.python.org/) -- [Glossary](https://docs.python.org/3/glossary.html) - [History](https://docs.python.org/3/license.html) - -## Community -- [Discord](https://discuss.python.org) +- [Glossary] + - [Language](https://docs.python.org/3/glossary.html) + - [Packaging](https://packaging.python.org/en/latest/glossary/) ## Use Cases - [Applications of Python](https://www.python.org/about/apps/) -- [Style Guide](https://peps.python.org/pep-0008/) +- [Effective Application] + +## Community + - [Discord](https://discuss.python.org) ## Learning Resources - [roadmap](https://roadmap.sh/python) diff --git a/spellcheck.yaml b/spellcheck.yaml index e1ea332..089d5e4 100644 --- a/spellcheck.yaml +++ b/spellcheck.yaml @@ -1,5 +1,5 @@ matrix: - - name: All Files + - name: English aspell: lang: en ignore-case: false