A module allowing for constant and publicly immutable data.
Project description
██████╗ ██╗ ██╗██╗ ██╗ ██████╗ ███╗ ██╗
██╔══██╗╚██╗ ██╔╝██║ ██╔╝██╔═══██╗████╗ ██║
██████╔╝ ╚████╔╝ █████╔╝ ██║ ██║██╔██╗ ██║
██╔═══╝ ╚██╔╝ ██╔═██╗ ██║ ██║██║╚██╗██║
██║ ██║ ██║ ██╗╚██████╔╝██║ ╚████║
╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
Pykon is a way to allow constant and publicly immutable data.
Though, data can be modified its type cannot.
With Pykon, errors are returned rather than being raised
giving the user the ability to control when an error should be raised.
Example
from pykon import Pykon
from typing import Union
mylist: Pykon = Pykon(list, [1,2,3,4])
if hasattr(mylist, "error"):
raise mylist.error
else:
print(mylist.data)
# Using a try except block
#
# try:
# print(mylist.data)
# except AttributeError:
# raise mylist.error
# Return a PykonError from a function
#
# def test() -> Union[None, Pykon.PykonError]:
# constantInt: Pykon = Pykon(int, 20)
# if hasattr(constantInt, "data"):
# print(constantInt.data)
# return None
# else:
# return constantInt.error
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pykon-0.2.tar.gz
(2.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pykon-0.2-py3-none-any.whl
(3.0 kB
view details)
File details
Details for the file pykon-0.2.tar.gz.
File metadata
- Download URL: pykon-0.2.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef3c2609b8dd5d5a101df77bdb12c6191006fcfbc6f55fec1297f3ddc0616b38
|
|
| MD5 |
29bb0bceb07115f34987a06dba2237e6
|
|
| BLAKE2b-256 |
d64b80a41e257aceb6fd434a557bf0792bb73d40a751deeed88d1d8bcaa05691
|
File details
Details for the file pykon-0.2-py3-none-any.whl.
File metadata
- Download URL: pykon-0.2-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
466bbd0e8ef921750e607a8b59b858969dfac03d13a7254157a37be991c51365
|
|
| MD5 |
637b2260aed8ef164884955a09082d38
|
|
| BLAKE2b-256 |
35badc4a8ca9132c32f296a58ce5284ae66eafce4179710b7725540f6b22330b
|