defl/README.md
2024-09-11 11:14:03 -04:00

37 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# philosophy
## classes
- compositional
- only init manipulates the object
- no inheretance
- functions return a clone of the object with primary data object cloned and manipulated
## other
- heavy inference from type hints
- library-ize everything
- thin CLI wrapper as stand alone file
- pyproject setup only
- deveopment branch with pyenv to source into shell for development
- data oriented with classes being simplest data conainers with helper functions
## imports
Files with an _prefix_ underscore are, by convention, imported in `__init__.py`. For example,
```python
from ._rgb_ import *
```
This will import all of the functions from `_rgb_` into the modules name space. So If `_rgb_` contains a function `interpolatePoint` you can reference it by `PythonModuleDemo._rgb_.interpolatePoint` or more simply `PythonModuleDemo.interpolatePoint`. Since this module is intended to provide a swath of functionality I wanted to provide the user with the simplest method of access.
The reason all files end with a _suffix_ underscore is to avoid any name collisions with python standard Library. For instance I have a file called `_math_.py`. If it were only called `math.py` it would collide with python standard Library when doing `import math`.
# import time
```bash
λ timeRepeat.py - -c 500 -- python -c ''
0.021840
λ timeRepeat.py - -c 500 -- python -c 'import defl'
0.161801
λ python -c 'print(0.161801/0.021840)'
7.4084706959706965
```